Tips and tricks and other WTFs Idk about

Im new to C++. I have been working on my blackjack program but kinda stuck on how to put it all together.

While I sort thru the mess that is (was) my brain, tell me some of the neat trick and any tips you might have for new programmers.
Split your code into functions. Thats the best way to keep your stuff organized.
Use comments all around so you don't need to read through each function.
Classes help to reduce code size by replacing multiple functions.
Write it down before you put it into code.
I have found out comments are your best friend :] I even use comments like a break function.. However, splitting your program into functions is better, but still confusing (To me)
- Make sure you got a good plan before you get started. You should know what you want and how it should work before you start writing code.

- Use clear names for classes, functions and variables (maybe you'll need longer names, but you'll see it shall save you a lot of confusion).

- If you're making a large program, use header files. Putting it all in one .cpp file will get confusing

- Write functions to get input. cin>>int and stuff like that will give you problems if the user inputs someting else as asked
Last edited on
- Use clear names for classes, functions and variables (maybe you'll need longer names, but you'll see it shall save you a lot of confusion).


Agreed, just don't use TOO long names...i.e.:

ClassName.getName(); is probably just as good as
ClassName.getUserFirstName();
Topic archived. No new replies allowed.