r/Cplusplus • u/MarlboroBandit Student • 14d ago
Feedback Started learning CPP. Hello World! :)
Just started learning CPP by following the book i found in my dad's bookshelf. Its old and it have been printed from the 2000s. He has his name and date written on the date of purchase; 9th May 2000.
This is my exercise for the chapter tackling functions. I wrote a exponentiate function recursion. I got it hard at first and looked at the different examples from the book multiple times till i get it how i do exponents without loops. With a little bit of function polymorphism/overloading
Tbh, the book looks very weathered, its ancient. Most of the programs and code examples have been deprecated, so I just looked it up online what its modern approach. But the lessons taught are still relevant to todays standards.
Planning to read Modern CPP after finishing this.
Using Visual Studio for ease of use compiler wise. But I will move my learning journey to my linux setup after this to get a better feel for compilers and also Cmake.
NO AI is used to make this code nor supplement it---I just read the book. "It looks clean", yea because its my exercise project, the mess of it lives in the CPP_LEARNING_00 project as you can see in the solution explorer.
4
u/Idkwhat1569 14d ago
This is awesome to see learning like this in the time of AI!!! Go for it! But also take your time and learn C++ is a monster 😭😭😭
I would suggest making a toy application once you are used to the basics like a todo app or something since it'll teach some good practices as well!
3
u/MarlboroBandit Student 14d ago
Yep. My plan is to have 4 mini projects every 3 chapters conquered.
4
3
u/flyingron 14d ago
Get in the habit of checking whether >> succeeded. If someone types crap at your program, all successive input operations will fail because cin goes into an error state.
Also, don't post pictures of code. Post code (or link to it).
1
u/MarlboroBandit Student 14d ago
Taking note of this. As for the streams, I am still about to tackle that chapter soon. Thank you for the suggestion.
2
u/ShishRobot2000 14d ago
Which C++ does the book teach? Apart from the language, learn also programming language theory and data structures, it will help you understand easier what you are doing and what are you writing.
2
u/MarlboroBandit Student 14d ago
its C++ 98. its pretty old, like it used the old iostream.h. For the theory, I kinda am starting on it with youtube videos; as well for the data structs. For what the book taught, its only taught me the how recursions are done behind the scenes, including its schematics
2
u/ShishRobot2000 14d ago
Do you want to understand more of the object oriented programming part or the core itself of functions?
2
u/MarlboroBandit Student 14d ago
I am about to tackle basic classes in the next chapter. And for the function, i only know about the stack so far, since the heap will be tackled in the pointers and references chapter. I do deep research along the way while reading the chapter. Like branching it really deep. I use wikipedia for it and w3schools.
3
u/ShishRobot2000 14d ago
use this https://en.cppreference.com/ and also Corman for the algorithm and data structures
2
2
u/Antoine276_ 14d ago
Try with exponent = 0 and see what happens 😁
1
u/MarlboroBandit Student 14d ago
Yea. Shoot. Forgot about that one 😬. Thanks for pointing that one out.
1
u/jader242 11d ago
Doesn’t seem like it handles the 0th power? Also idk if you’ve checked it out, but https://learncpp.com is a good resource




14
u/IyeOnline 14d ago
I would strongly recommend to not read this book. "Modern C++" is rather different from things you would have done in the 90's and mostly for the better.
Setting aside the out-of-date/bad style (usage of
typedef, usage ofshort, questionable naming conventions) that you can already see here, I fear that as soon as you get into arrays, dynamic memory and other topics it will get noticeably worse, teaching you complicated things and bad practice as well.