Next: Input and Output
Up: A simple C++ program
Previous: Constants and the declaration
At this stage the programs considered will fit into the following general format:
//
Introductory comments
//
file name, programmer, when written or modified
//
what program does
#include <iostream.h>
void main()
{
constant declarations
variable declarations
executable statements
}
Note that it makes complex programs much easier to interpret if, as
above, closing braces }
are aligned with the corresponding
opening brace {
. However other conventions are used for the
layout of braces in textbooks and other C++ programmers' programs.
Also additional spaces, new lines etc. can also be used to make
programs more readable. The important thing is to adopt one of the
standard conventions and stick to it consistently.