C++ PROGRAM STRUCTURE

 

C++ PROGRAM STRUCTURE

Programs is a sequence of instructions or statements are known as programs. These statements are used to form the structure of a C++ program.  C++ programming also provide the flexibility of writing a program with or without a class and its member function definitions.

The C++ program structure is divided into two types.

(i)   Program structure with class

    1. C++ headers (Include files)
    2. Class declaration
    3. Member function definition (class function definition)
    4. Main function

Explanation:

1.      C++ headers

*  It contains the information like prototype, definition and library function.

*  Standard headers are specified in a program through preprocessor directive “# include”.

2.       Class declaration

            Used to declare the class with member Data and functions.

3.      Member function definition

* Used to define the functions declared globally or in the class.

                  * It is used when a program code is divided into small blocks.

4.      Main function

*  It is the starting point of all C++ program.

* This function is called by operating system when your program is executed by the computer.

*  Open brace {is the start of a code

*  Close brace} is the end of a code

*  It has two sub – sections:

                      1. local declaration

                      2. executable code

 (ii) Program structure without class

Comments