What is Structure of C++ Program

C++ Programming language is most popular language after C Programming language. C++ is first Object oriented programming language.
The most common type of instruction in a program is the statement. A statement in C++ is the smallest independent unit in the language. In human language, it is analogous to a sentence. We write sentences in order to convey an idea. In C++, we write statements in order to convey to the compiler that we want to perform a task. Statements in C++ are terminated by a semicolon.

There are many different kinds of statements in C++. The following are some of the most common types of simple statements:

Section 1 : Header File Declaration Section
Header files used in the program are listed here.
Header File provides Prototype declaration for different library functions.
We can also include user define header file.
Basically all preprocessor directives are written in this section.
Section 2 : Global Declaration Section
Global Variables are declared here.
Global Declaration may include –
Declaring Structure
Declaring Class
Declaring Variable
Section 3 : Class Declaration Section
Actually this section can be considered as sub section for the global declaration section. Class declaration and all methods of that class are defined here.
Section 4 : Main Function
Each and every C++ program always starts with main function.
This is entry point for all the function. Each and every method is called indirectly through main.
We can create class objects in the main.
Operating system call this function automatically.
Section 5 : Method Definition Section
This is optional section . Generally this method was used in C Programming.

Leave a Reply