Jump to content

  • Log In with Google      Sign In   
  • Create Account


Best way of learning C++?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
10 replies to this topic

#1 Detectiverr   Members   -  Reputation: 112

Like
0Likes
Like

Posted 02 July 2012 - 04:33 PM

I got a C++ book on the front of me. Are there any methods of learning C++ execpt reading it off...? Share your learning experience...!

Sponsor:

#2 DevLiquidKnight   Members   -  Reputation: 834

Like
3Likes
Like

Posted 02 July 2012 - 04:36 PM

I got a C++ book on the front of me. Are there any methods of learning C++ execpt reading it off...? Share your learning experience...!

You should try making some programs, if the book has exercises do them. Theirs also tutorials online for C++. http://www.learncpp.com/, http://www.cplusplus.com/doc/tutorial/.

Theirs really no wrong way to learn C++, (other then confusing it with C) if you feel comfortable using the book just use it.

#3 Serapth   Crossbones+   -  Reputation: 5266

Like
6Likes
Like

Posted 02 July 2012 - 05:12 PM

You could try pressing your face against the book and learning through osmosis, but I doubt you will have much success.


Seriously, how much effort is it to read a book. Read it, then you will know how useful it was teaching you C++!

#4 Detectiverr   Members   -  Reputation: 112

Like
0Likes
Like

Posted 02 July 2012 - 05:20 PM


I got a C++ book on the front of me. Are there any methods of learning C++ execpt reading it off...? Share your learning experience...!

You should try making some programs, if the book has exercises do them. Theirs also tutorials online for C++. http://www.learncpp.com/, http://www.cplusplus.com/doc/tutorial/.

Theirs really no wrong way to learn C++, (other then confusing it with C) if you feel comfortable using the book just use it.


There's some program exercises on the book but there's no answers to the program so I didn't do them. However, I did the ones with the answers on them. :D

#5 Detectiverr   Members   -  Reputation: 112

Like
1Likes
Like

Posted 02 July 2012 - 05:20 PM

You could try pressing your face against the book and learning through osmosis, but I doubt you will have much success.


Seriously, how much effort is it to read a book. Read it, then you will know how useful it was teaching you C++!


Ok I'll try to press my face against the book and learn :D

#6 jbadams   Senior Staff   -  Reputation: 17772

Like
4Likes
Like

Posted 03 July 2012 - 12:02 AM

In general, there usually aren't "best" ways of doing most things -- there are different ways that may be more or less suitable for a certain situation -- but in this case I'm going to go out on a limb and suggest that the Best™ way of learning any programming language -- C++ included -- is to actually write programs using that language. There is simply no substitute for actual experience with the language. By writing code, you get to actually try out the concepts you are reading about, you can start to commit details to memory via repeated use, and you can encounter problems and expand your knowledge by finding out how to solve them.

The book probably doesn't provide answers for all of the example problems because there is more than one way to correctly solve the problem; if you can write a piece of code that compiles and produces the correct result, you can consider that program to be correct.


Read your book.
Attempt all the exercises it provides.

Make up your own variations on the exercises in the book; "I want to take this program, but instead of outputting this, it should output this slightly different result." Make the necessary changes and check it if works; if it does you can move on, but if you were wrong there might be a flaw in your understanding of the material, and you have an excellent opportunity to learn more by finding out why your change did not have the desired result as well as what you could have done instead.

Take examples from the book that you have already got working, and make one completely random change to them. Just delete a character, or move something to a different line, or whatever. See what happens. You might get a compile error -- great, you now have real world experience with what caused a particular error, which may help you if you see that error in future. The program might compile, but will behave differently -- again, a great learning experience to see what sort of results can occur from seemingly simple errors in the code.

Read other sources of information about whatever you are learning. These could be online tutorials, or another book. Do any exercises they provide as well, and have a bit of fun with them as suggested above. If you get to a point where you're completely bored with a particular concept, and are always right about the results of any changes, then it's time to move on.


Create your own exercises. Try to make small games with what you've learned.

Make a "guess the number" game where the computer tells the player "higher" or "lower" until they guess correctly. Make it handle incorrect input (i.e. what should happen if they enter a letter instead of a number?) in some sensible fashion. Give the player the option to try again or exit. Let the player set the difficulty by specifying the range the numbers could possibly be between (i.e. 1-10, or 1-50, etc.).

Make a "hang-man" game where the player has to guess letters and figure out the words. Learn how to load a random word each time. Learn how to load the words from a file instead of including them in the program.

Make a tic-tac-toe (noughts and crosses) game -- you can just draw the board with text. Make it two player. Make a one-player version where the computer makes moves; make it so that the computer will always win if it goes first, or at worst tie the game if it starts second. Make a version where the computer makes believable mistakes.



If you can do all of the above without trouble, you've finished your book and done all the exercises, and you feel comfortable with giving it a go, you might then learn how to create a window and draw graphics with a library such as SFML or SDL. If you're looking for additional exercises to try you might try the exercises at Project Euler.


Practice, practice, practice.


Hope that's helpful! Posted Image

#7 MotorBully   Members   -  Reputation: 144

Like
0Likes
Like

Posted 03 July 2012 - 07:45 AM

Doing the c++ programming exercises everyday is surely boring!!!!once you learn a chapter , you should try to find some interesting problems and use the c++ to solve it,
this will make you to be interested in C++ and also develope your thinking,your speed of study will going throw the roof.Posted Image

Edited by MotorBully, 03 July 2012 - 07:46 AM.


#8 Matt-D   Crossbones+   -  Reputation: 1432

Like
0Likes
Like

Posted 03 July 2012 - 10:30 AM

Sure, there's more (as in: in addition to going through the book(s)) things you can do: http://norvig.com/21-days.html :-)

#9 Gazu   Members   -  Reputation: 216

Like
0Likes
Like

Posted 05 July 2012 - 04:44 AM

Whenever I want to learn something completely new related to programming, I check out this youtube channel.
That guy (or by now, those guys) teaches tons of stuff via little tutorials (few minutes each), which you can just blaze right through them.
There aren't any exercises (but always examples with easy to understand explanations) and It won't make you an expert, but wou definitely will understand how all that stuff works, so it's a good starting point.

#10 scniton   Members   -  Reputation: 252

Like
0Likes
Like

Posted 05 July 2012 - 07:49 AM

Like it has been stated the best way to learn is to actually use the language once you've read enough to get started.

I think the hardest part of learning a new language is coming up with exercises that are both interesting and manageable (i.e. can be accomplished without spending hours after hour on it.)

C++ is a large and complex language, learn the basics then learn the rest as you need it (it is easy to get overwhelmed imho.)

Also, C++ allows many different programming styles, and the ressource you're using might suscribe to one particular style or philosophy, I think it is useful not to suscribe to one particular style (i.e. not assuming that what you are taught is "the way" or "the only way" to accomplish something in c++.)
Stop twiddling your bits and use them already!

#11 DZee   Members   -  Reputation: 194

Like
0Likes
Like

Posted 05 July 2012 - 09:34 AM

If there's one book I'd recommend to anyone it's this one :

C++ Primer Plus, 6/E

by

Stephen Prata




Not only does it cover C++ 11 features, each chapter ends with questions and exercises.

I "surf" the web, literally.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS