r/Cplusplus • Student • 15d 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.

163 Upvotes

19 comments sorted by

View all comments

Show parent comment

3

u/no-sig-available 14d ago

That this book teaches me bad habits,

Yes, it is not common to name all functions funcSomething, or have all numeric values contain Num, like why baseNum instead of just base?

Also, using names like USHORT and ULONG will get you into trouble (because some system headers have already been stupid enough to declare these :-).

1

u/MarlboroBandit Student 14d ago

Yep. Thats how the book does it. A clown teaches a clown 🤡. Can you suggest any book? Thanks

4

u/Discordbothost 14d ago

Stroustrup's Programming: Principles and Practice Using C++ (3rd edition) is aimed at beginners and uses C++20/23. his page has the contents and sample chapters, so you can check the approach before buying: https://www.stroustrup.com/programming.html