Ask HN: What is the fastest way to learn C++? I have a exam in 10 days.

5 points by nikkfs ↗ HN
I'm a 12th grade student, I've my final exam in about 10 days and I'm not prepared at all and I'm pretty sure that I'm going to fail. What should I do. Help!

19 comments

[ 3.1 ms ] story [ 49.3 ms ] thread
Find a time machine, go back in time, and actually learn C++.
This sounds nice. Do you know where I can find one?
Learn that you need to work on these things in advance, when you're supposed to, and that trying to cram simply doesn't work in most cases. Even if you succeed in passing this exam, you still won't know or retain enough to go to the next level. You are setting yourself up to fail harder, with no hope of getting out of the spiral.

Sounds harsh, but I speak from experience. It would be nice if other people could learn from my mistakes. Seems unlikely.

And you haven't told us what you already know, what's likely to be on the exam, what level you need to work at, what you're likely to be asked to do, whether you'll need to write a program, whether you need to design a program, or, really, anything.

Step 1: Find out what's likely to be on the exam.

Step 2: Decide honestly what you already know.

Step 3: Ask a specific question.

Step 4: Lather, rinse, repeat.

Yes, I'll be getting questions like write a program which prints table from 11 to 20 upto multiple of 10 and write a program which tells the difference between two integers and some more questions like these. I already know PHP and JavaScript, so I've a good idea of how programs work, but C++ is fully object oriented and they're totally different from PHP's OOP except the curly braces.

    ... write a program which tells the difference
        between two integers ...
I don't understand what that actually means, but you could start by:

1. Write a precise example of an exam question,

2. Write a program that you think answers the question,

3. Make sure it runs,

4. Ask for advice about what you've done well, and what you've done badly,

5. Lather, Rinse, Repeat.

Read everything you can find for the next 10 days?
Are you a C++ programmer?
Is it going to keep you from graduating? Are you already accepted to college at this point? How badly will it hurt you? Do the math and figure that out first. It's probably not the end of the world... and next time do your homework :)
Unfortunately, I won't go to college if I fail.
This doesn't sound like advice but it is.

First: Don't panic. It won't help and in fact will make things worse. Most of the fear comes from the unknown, which the rest of these steps address.

Second: follow ColinWright's four steps in his comment here. (What you should have been doing anyway, but I'm sure you already know that. Anyway it's too late to change the past).

Third: Consider the context: did you just goof around all semester when you should have been learning C++ or have you been doing a bunch of programming languages and C++ is simply the latest of the set?

If it's the latter case, then realistically the test won't cover much of the language and the amount you will need won't be so huge (see item "First" above). You can ask the teacher for help.

If it's the former case, well, OK, you know you won't be getting an awesome grade. Take a few deep breaths, reflect on this and then put it aside. You can't affect that but you can affect how well you do.

Fourth: Realize that one part of this lesson is about planning and context. To you, a year 12 student, this is a big deal. To me, who just turned 50 this week, it's simply the kind of thing that added to the mix that made me who I am. I was a good, diligent student AND I was a fuck up. At the same time, all mixed together. And I ended up being what many people would call a success.

My friend Esther Dyson likes to say, "always make new mistakes." That means it's best if you both learn from what happened (perhaps poor planning, which is chronic among students; or perhaps just a lack of perspective) so that you eventually learn not to make the same mistake, but also learn that you will always be making mistakes your whole life.

I know a final exam seems like a huge deal, and I'm not trying to tell you not to take it seriously! But in the scheme of things you'll survive and, depending on how you handle it, thrive.

the syntax of C++ is easy to learn in 10 days. Syntax is nothing more than a collection of rules regarding a regular language.

Thinking like a programmer/engineer, and problem solving, that takes a lot longer than 10 days.

I would say focus on learning libraries, since that's the majority of what people consider "learning" a language. Syntax is somewhat easy (minus some....okay many of c++'s nuances), but learning libraries is the difficult part.

Don't read though, do. You need to actually write programs to become good at writing programs. Don't spend time reading specifications, because that will only get you so far.

If you're good at math, the first few problems on project-Euler would be a good starting point, but there are other challenge type websites around.

Personally, knowing what I know now, the place to start is * <iostream> standard I/O (console) * <fstream> file I/O * <cmath> Math library

Becoming familiar with some functions in those libraries will get you a decent starting point

1. Stop reading hacker news. Procrastinating is (probably) what got you into this mess

2. If you are in twelfth grade, you aren't expected to be a good C++ engineer/dev, you are expected to know some curriculum they gave you already.

3. If you have the curriculum, you should start grinding through the lessons you have already been given. It's what you are going to get tested on.

Sorry, this may not seem helpful, but getting as far as you can through the courseware you should already have, is going to be the best thing to do. Unplug the internet if you can, and just grind through it. If you pass, it will have built character.

Edit; ColinWright has some good comments too. Seriously look at what you already know, and try to use any questions/tests built into your curriculum (if there are any) to test yourself.

First of all can you tell me if you are a cbse class 12 student?
The fastest way to learn C++ is to write programs in it. If your textbook has exercises at the end of each chapter, work through a couple of them per chapter. You won't be able to do everything in 10 days, but you can do more than you think you can.
Classy! Same shit happened with my girlfriend a year back. I must clarify, both of us were 12th graders in the same school in India back then. Had to explain her the C++ syntax just a day before the exam. And that's asking a lot counting in all the OOP concepts, memory mangament and neat data structures that needed to be covered. You, my friend, are much well off considering you still got ten days and already know PHP & Javascript.
1. Look at 'Teach yourself C++ in 21 days' (http://www.angelfire.com/art2/ebooks/teachyourselfcplusplusi...)

2. Follow it.

3. Write the exam. Who needs arrays, inheritance, or polymorphism?

But seriously, both ColinWright and Rantenki have pretty much hammered a nail there. You haven't given us any more details other than you're a 12th grade student.

- Until what part do you have to learn? What do you have to do?

- How much time do you have to concentrate each day?

- How desperate are you?

- Is your goal simply to pass, or to get a good grade?

- Following on the first point, is this an yearly exam? or end-of-term exam? Figuring out what the problem is the first step of solving one.

The good news is that you already know how to program, even if you are intimidated by OOP. The other commenters are probably correct in suggesting that previous coursework from your class will give you the best sense for what you'll be tested on but, if you have 10 days to learn about OOP/C++, you could do worse than spending at least a little time reading some well-presented explanations of classes, inheritance, operator overloading, virtual functions, polymorphism, and the like, as a means to supplementing the language-agnostic programming concepts you already understand (through your adventures in PHP and JavaScript).

There is a ton of C++ info on the web (of varying quality, of course) but sometimes I think, when trying to learn something new, getting offline and looking at a physical book improves my focus.

I've read many C++ books over the years, but the one that finally made everything click, at least for me, when I was first learning C++, was "C++ How to Program" by Deitel and Deitel. The copy I have is 20 years old (yes, I'm old :) ) but I suspect the newer editions (http://www.amazon.com/C-How-Program-8th-Edition/dp/013266236...) have similar approachability.

Good luck to you and, as others have suggested, do not panic. Though it seems like a massive deal to you right now, rest assured your perspective will change down the road.

Find a book about C++. Read as much of it as you can. Write some code. (solving a few Project Euler problems might be worth it as long as you focus on writing dumb brute force solutions). Prioritize the parts of the book that cover things you think will be on the test.

I have no idea if this is good, but its free: http://rooksguide.org/

1. Pick up a good C++ book if you already don't have one (coursebook or Herbert Schildt or some O'Reilly book). 2. Open an IDE of choice. 3. Start reading, write code & understand what you code. 4. Calm down, repeat 3.

Do well.