r/programminghelp • u/collegecolloquial • Jan 19 '23
C++ Explain like I’m five: coding? C++?
I am a freshman aerospace student currently taking an “intro” coding class for c++ and Matlab
I’ve tried to learn any coding (c++, python) previously but have always found it not to be accessible, it feels like all the basic info isn’t basic at all
In fact to me learning c++ right now feels like if i was put in a physics class and had never taken math
I’m missing fundamental basics and everyone explains it to me in terms that are way too confusing, terms that aren’t beginner terms
What I am understanding is C++ is a language for coding and programming and that is the extent
But coding what? Programming what? Whenever I try to get an explanation I don’t even understand the explanation!
Even my textbook said “this textbook is not ideal for first time coders” but the class is suitable for students who have never coded
I don’t even know what coding is used for and “the following line says that main is a function with no parameters that returns an int (integer) value” means nothing to me and it was essentially the first thing in my textbook
I get that it’s like learning a new language but i don’t have any context in my brain and am struggling.
I am eager to learn and to try but need a little explanation into what it is i am even doing
1
u/Svani Jan 19 '23
Other answers are overcomplicating a simple thing.
Computers are math machines. They can do basic math operations (2 + 5 = 7) and basic control operations (if x > y, do this, otherwise do that). That's it. But, like Legos, with a few basic pieces and a lot of creativity, you can build amazing things, like videogames and simulations and whatnot.
And, just like with Legos, building something big piece-by-piece is a lot of tedious work. In computers this is called the machine language, and you can 100% do everything in it, but it's slow and error-prone. So people invent programming language, which automates a lot of the repetitive work.
How does it happen? You write what you want the computer to do in a programming language, which is just text in a file, then you give it to a program called a compiler that will read it and translate it to machine language, and the result is a program that the computer can run.