Creating a c++ program


Creating a c++ program

A c++ program is a collection of functions one of which is the function main . Therefore  if a c++ program has or consists of only one function then it will be the function main.Moreover a function is a set of instructions designed to accomplish a specific and special task.

The syntax of the function main is

int main (   )

{

 statement 1
     .
     .
     .
statement n
return 0;

}


in the syntax of function main each statement is usually either a declarative statement or an executable statement.The statement return 0; should be included in the function main and should be the last statement.Source code must be saved in file with the file extention .cpp.