Structure of a Basic C++ Program [C++ Tutorials – 3]

Here I am sharing you the most Basic C Plus Plus Program Structure.
C++ program consists one or more functions. A function called main() is must in a C++ program which cannot be used more than one time in a program.
The execution of any C++ program start at main() and ends within main(). The calling of other functions is done within the main() function.
Structure of a C++ program
#include<header file> void main() { statements; }
The C++ program starts with header files. Header files are the C++ library files which include some functions required in the program can be obtained.
The function definition starts with the opening brace { and end with the closing brace }. The statements of a program are written inside the { and } o the main function.
Each statement in C++ is eliminated by a semi-colon ( ; ).
C++ supports the writing of comments inside the program. Any single line comment can be expressed by adding a double slash before the comment.
Example
//C++ is an OOP language.
Multiline comments begin with /* and end with */.
Sample C++ Program Using Comments
#include<iostream.h> void main() { //This is a sample program cout<<"C++ is a superset of C"; /*The above cod will print 'C++ is a superset of C' in the output window. The statement 'cout<<' is used to print in C++ program.*/ }
The output of the above program code will be as shown below.
C++ is a superset of C