Dec 21, 2008 at 4:33pm Dec 21, 2008 at 4:33pm UTC
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.
Dec 21, 2008 at 4:36pm Dec 21, 2008 at 4:36pm UTC
Split your code into functions. Thats the best way to keep your stuff organized.
Dec 22, 2008 at 5:50am Dec 22, 2008 at 5:50am UTC
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.
Dec 22, 2008 at 5:00pm Dec 22, 2008 at 5:00pm UTC
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)
Dec 22, 2008 at 5:09pm Dec 22, 2008 at 5:09pm UTC
- 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 Dec 22, 2008 at 8:57pm Dec 22, 2008 at 8:57pm UTC