OOP1
OOP1
C++ Program
Sequence
1)Preprocessor Directive:
#include< >
For Example:
#include<iostream.h>
#include<conio.h>
#include<math.h>
/*#include is a key word and
iostream.h, conio.h, math.h are header files.*/
#define /*Constant*/
For Example:
#define p=3.1415
/* #define is a key word use to define constant
and p is any constant number have value
3.1415.*/
2)Name Constant:
For Example:
const float p=3.1415;
/*const is key word, float is the data type of
const and p is a constant number having value
3.1415.*/
3) Global Variable:
/* A Global Variable is the variable which use
more then one Functions or Sub Program.*/
For Example:
int a;
/* int is the type of variable and a is the name
of variable*/
4)Function Proto-Typing.
For Example:
float area(float r);
/* area is a function which carry the value of a
float type variable name r and return back a
value of float type*/
5)main( )
/* main is the main function which called
automatically */
{
variable declaration;
other executable statement
:
:
:
:
return statement;
}
/* inside the { } there will be the a program
which works according to our designing.*/
6)Function definition:
For Example:
type name(variable)
{
Body of function
}
/* Definition contain name type and the variable
which shifted from main function and then
working and logic of function after then return
the value.*/