• Happy holidays, folks! Thanks to each and every one of you for being part of the Tom's Hardware community!

Question How to learn C++?

miha2

Distinguished
Aug 14, 2009
533
1
18,995
Hi everybody, I want to learn C++. But I don't want to just read the book and learn 'if' and 'while' and say I know C++. What I want is:

Ideally: Find the code on Github or some other source, with a whole ton of comments on why this piece of code is here, what it does, and so on.
Better: Find a video (not necessarily a free one, but not overly expensive) that will teach well enough to write code.
Good: Read a book that will explain everything. Read a book with examples; with a brief piece of code and tons of explanatory material after it.

Also, I would strongly prefer several different examples, not just one or 2 programs. I want to understand how the computer thinks, that is, how to write the algorithms (the code) that the computer will understand for sure, how to write the looks of the programs, and... pretty much, a lot more. I understand it may be impossible to learn the entire C++, but... To start it, and we'll see how far I can go with that. (OK, OK, I want to be able to understand any pieces of code, to be able to read the source for a lot of programs: there is foobar2000, there is 7zip, there is VeraCrypt, there are a lot of other programs with source code available. I want to be able to read the code and understand it. Sounds reasonable?)

Any ideas? Any recommendations?

Is it even possible after all?
 
No. And that is good to learn that there is a difference. But is there a lot of difference? Ideally, I'd like to know both, I guess. I don't have any experience neither in programming nor software design, nor anything associated with computer coding.
 
well if you want to understand all that , you will need not only to learn C++ , you will need to have some Logic knowledge , Mathematics ...

C++ is a tool , What you do with it Depends on what you want to code ...

you can read the source code but never understand it if you dont have the knowledge used in that Algorithm , being Numerical Analysis methods , to Tensors and Vectors and Matrices ...

Try Open University of Hagen , it is for free if you live in EU or USA ... and they have tons of courses to choose from.

Learning the Language alone will not make you a programmer ...

Youtube is also good for finding lessons online for free . some universities have their classes Videos online to watch as well for free.
 
No. And that is good to learn that there is a difference. But is there a lot of difference? Ideally, I'd like to know both, I guess. I don't have any experience neither in programming nor software design, nor anything associated with computer coding.

OK, then don't START with C++. Start with an interpreted language like basic or JAVA script. Compiled languages are more efficient but slower to debug and interact with.

Is there a lot of difference between software design and programming? ABSOLUTELY software design, is just that. determining the logic and behaviors that implement the desired outcomes. Programming is translating that DESIGN into machine language. Software design does not deal with implementation, it deals with the abstract. "User pushes 'print' button". That is software design. Programming is creating the code that puts the print button on the screen and handles the implementation to print something.
 
i'm currently taking a java class that uses greenfoot to explain things. in many tries with trying to learn some kind of programming language this is the first time i have ever actually accomplished anything. the key for me has been the way it uses scenarios. the first 4 chapters of the book takes a basic game that does nothing and walks you through adding the pieces of the game one by one. then it changes scenarios and starts a new game with different ways of doing the same thing as before and adding some new elements to the game and so on.

in the past i failed to learn anything simply because i was not actually creating anything and i made no connection between the commands i was learning and what i could do with them real world. i know greenfoot is a heavily walled environment but i am learning the idea of object based programming and know that if i decide to move into the bigger world of java i would be able to read documentation and be able to create something useful and i'm only in ch 6 of the book 😀

my suggestion to you is find something similar for whatever language you want to learn. i see lots of stuff from skillshare and linkedin learning that are based on this idea of not just learning commands but actually making something useful as you go. whether it is a game, database, or whatever. being able to link the commands to something tangible has been all the difference to me and has me excited to actually go to class and show off what i managed to add to my little game since last week.

i actually have an idea for something totally new not in the book i am going to start working on soon just to see if i can do it.
 
Years ago I looked into C++ without any coding experience, I didn't last long. It's not that people can't start with it, I'm sure many do, but you have to be very motivated. For me at least, it was very overwhelming because as others point out, you are learning a lot more than just syntax if you have no experience. As kanewolf pointed out, start with a simpler language to learn all of the basics. I got back into it with VB.NET, though this was like 10 years ago. I'd suggest python as an easy language to get started with. I picked up Zed Shaw's Learn Python the Hard Way book.


As for the basics like While, If/Else, etc, these are very important building blocks that you need to really understand. Just like learning and instrument, the basics are boring but absolutely necessary.

Also, nobody gets through a book and says "yep, I've mastered the language". You learn the building blocks and you have a book to reference them when you put them into practice. After I got through the python book, I thought up a few simple things I wanted to do to solve a "real" problem. I think the first one was a small program where I could read words typed in a text file (my kids school spelling words), show them back to them in a random order so that they cold practice their spelling.

Good for you for wanting to learn and good luck!
 
Try Open University of Hagen
All I could find is that it's in German. In case I'm wrong, please supply me with the link to English version. Of the "open" University.

you can read the source code but never understand it if you dont have the knowledge used in that Algorithm , being Numerical Analysis methods , to Tensors and Vectors and Matrices ...
Well, I"m not going to jump right in. I'll go slowly, I'm thinking that if I understand the meaning of the function, when I see it the next time in the code on Github, I will know what it means, and hopefully, why it's here and what it does here. Am I wrong? If so, maybe it is too early for me to learn such advanced language, and maybe it'll be easier to start learning Python. After all, Blender is written all in Python, I think. To understand the logic, to understand how programming works in general.

Is there a lot of difference between software design and programming? ABSOLUTELY software design, is just that. determining the logic and behaviors that implement the desired outcomes. Programming is translating that DESIGN into machine language. Software design does not deal with implementation, it deals with the abstract. "User pushes 'print' button". That is software design. Programming is creating the code that puts the print button on the screen and handles the implementation to print something.
Well, then ideally, I want to know both! I want to know how to write the code that will meet my needs, I want to create a task to later work on, and work on it once I'm done creating that task!

Let's say I want to write the Mario Bros. game. Old good Mario for NES, but the PC version. I want the bricks to be destroyable, and this is a task. Then I want to code that part. Next, I want to make so that when I jump on the turtle, it hides in the shell, and the second time I jump on it, it slides in the same direction you jumped from. And so on. Software design to create a task -> programming that task -> software design to create a task -> programming that task... (Well, first create all tasks, or at least, a set of tasks, and then program them.)

Logic works in the right direction so far?

i see lots of stuff from skillshare and linkedin learning that are based on this idea of not just learning commands but actually making something useful as you go.
This is exactly what I'm looking for! Learn as you do something! Can you give me links, please?
 
a lot of the video based courses i have seen have been on skillshare.com you can get a free month to check it out.

there are too many out there to list links. i'd search for the language you want to work with + what you want to try and create.

for instance "create a game in c++" or whatever you think you're interested in. then start looking for one that grabs your attention. i've not tried many myself other than this greenfoot java class. but i can't think of a more interesting way to learn how to do it. start small and expand from there. a few hours making something cool will do more for you than weeks of mindlessly reading definitions and code snips. as you expand you'll start looking for more and adding to your knowledge base but you won't notice cause you're directly trying to make something happen so you're not bored while doing the midless reading
 
a few hours making something cool will do more for you than weeks of mindlessly reading definitions and code snips.
Well, this is exactly why I started this thread. To find out good tutorials, which would explain if not everything, then at least, a lot, so I could start. Later on, I will be trying to move ahead, learn more and more, trying to understand the logic of C++.
 
one place to look would be your local library.

my city has a growing list of digital books we can check out. you should be able to browse what they have and select a few that are along the lines we are looking at. wish i could point to a specific c++ book but never looked into that language. as others have noted c++ is pretty hard core and something easier to start with might be a better way to go. the logic of it all is mostly the same. so once you get the idea on an easier language it's not too hard to swap to another language and learn the syntax that goes with it. at least that's what folks have told me.