Program Comments: A well-written computer program in a high level language, such as C/C++, is said to be "self-documenting". Through the use of meaningful identifiers and logical flow of computer instructions, a program you write should be "readable" to another programmer. However, a programmers intention of what the program does and how the program does it are not always easy to see by looking at the program. That is why it is important to include comments in your programs.
The style of your comments includes where you put comments in your program and what you say in those comments. There are many different comment styles. You should follow the one described below, unless your instructor indicates differently. The elements that are considered essential to your programming are emphasized by "must".
File and program header comments: Each program that you write must have a comment at the beginning of the program that is called "a header" or "header comment". This must include the following information: Your name, the date, the name of the file the program is stored in, a description of the program and usage (how to run it).
As you develop your programming skills, you will divide your program into different files called modules. Each file must also contain a header comment that includes your name, the date, the name of the file in which the code is stored. You should also indicate what other files the module depends on.
An example of a header comment for a file containing a class implementation: