Tuesday 12 February 2013

Structure of C++ Programs - For Beginers


Include file

In C++ there are a number of files called header files. These files contain number of predefined functions, classes, variables and data. If we want to use the predefined functions, classes, variables and data in our program, the appropriate header file should be included at the beginning of the program. The general form of include file is

#include<headerfilename.h>

Examples : iostream.h, fstream.h, graphic.h, math.h, process.h, iomanip.h etc.

Class definition

It is an user defined data type having defined member functions and member variables. We can have more than one class in a program.

Main function

In all C++ programs, there is a function named main. Through this function only we can access other parts of the program. This function should return a value.

Variable, object declaration

In this section the required variables and objects are declared.

Body of main fuction

In this section valid C++ statements, message passing etc., are given.

0 comments:

Post a Comment

Powered by Blogger.