Tuesday, October 19, 2010

Lesson 3: Comments



The Introduction: Comments
Comments are very simple yet very useful. A comment is a note you make to the programmer (most often yourself) within a script that does not affect how the program compiles. It takes on two forms, the single-line comment, and the multiple-line comment:
//This is a single-line comment
/*This, however is not.
This is a multiple-line comment*/

The Code: Comments
#include <iostream>
using namespace std;
int main()
{ //Brackets act as a nice container
cout<<"Hello World!";
cin.get();
/*Without cin.get(); our program would
close without giving us a chance to see it.*/
return 0;
}

No comments:

Post a Comment