LiquifiedGold's picture

 Welcome to tutorial number three!

Now before we code anything else lets talk a bit about the code we wrote.

The first thing we are going to talk about is comments. This is a comment:

Every thing behind the '//' is part of a comment. If you type in '//' it will make the whole line a comment. However, if you type in '/*' it will make all the lines a comment. This type of comment needs to be closed with '*/'. It doesn't matter where you put the comments because when the computer compiles the code, it skips over the comments. Like so:

The main purpose of comments is to remind yourself what the code does.

Allright now lets talk about white space. White space is the blank space between the code. The white space can be arranged in any way. As long as you end your code line with a semicolon, you can arange your code in any way. Like so:

Be carfull though. Spaces inside strings are not ignored. For example you could not write "firstName" as fir st Name. Symbols that have an actual meaning must be kept intact. Also note that the #include directives are special kinds of statements that need to be on their own line. 

Lastly, lets talk about include directives. In the programs we write we will need to use some code we do not write ourselves. Most of this other code can be in the standerd library, which is a set of C++ standard utility code that ships with your C++ compiler. Some examples of useful code which the standerd library holds are:

) Code for outputting and inputting data to and from the console window
) Functions for computing various math operation such as sine and cosine
) Random number generators
) Code for saving and loading files to and from the hard drive
) Code to work with strings

 

Gaming Mama's picture
is thinking about playing Dawn of Discovery.
User offline. Last seen 1 year 46 weeks ago. Offline
Joined: 08/15/2009
Add friend

I finally read this- great job!

ShadowPwn's picture
is impatiently waiting for someone to join his forum...
User offline. Last seen 1 year 18 weeks ago. Offline
Joined: 08/15/2009
Add friend

Nice.  I love that comment placement in the second pic.  Plus the whole "shiny code" thing.  Keep it up!

Aut's picture
Aut
has found a cool Palkia sprite!
User offline. Last seen 20 weeks 2 days ago. Offline
Joined: 09/04/2009
Add friend

Nice tutorial Sadie!

admin's picture
playing Halo 3: ODST
User offline. Last seen 1 year 8 weeks ago. Offline
Joined: 07/05/2009
Add friend

 Great job!