C++ Comments

Once your program begins to get large, they will become complicated. It becomes necessary to put comments into your code. If you want other people to read your code, then comments are very helpful to the reader in understanding the code you wrote. There are two ways of writing comments :

#include <iostream.h>
// file comment.C
// another dumb meaningless program written by me.
main()
{
  /* this is a rather
     lame program.     */
  cout << "Hello World" << endl;
}

The first comment method is to use the // at the beginning of a line. Anything on the line that follows the // is a comment and is ignored by the compiler.

The other way is to put your comments between a /* and a */. This method can make comments over multiple lines.