#include directives : It tells the preprocessor to include tje contents of specified file in the source file in place of the directive before compilation,
#include<iostream.h>
In this example, the #include directive tells the preprocessor to include the contents of iostream.h file into the source file. The iostream.h is a header file that contains the declaration of all the standard Input/Output functions of C++. The compiler will generate erros if the file is not in the source code.
#define directive : The Other most often used preprocessor directive is #define directive. the symbolic constants can be specified using #define. The symbolic constants allow the programmer to define a name for constant and use that name throughout the program as Shown in the following example -
#define PI 3.14159
It replaces every occurrence of symbolic constant PI with a value 3.14159 before the program is compiled.
Conditions & Feautres :
Main Program Section :#include<iostream.h>
In this example, the #include directive tells the preprocessor to include the contents of iostream.h file into the source file. The iostream.h is a header file that contains the declaration of all the standard Input/Output functions of C++. The compiler will generate erros if the file is not in the source code.
#define directive : The Other most often used preprocessor directive is #define directive. the symbolic constants can be specified using #define. The symbolic constants allow the programmer to define a name for constant and use that name throughout the program as Shown in the following example -
#define PI 3.14159
It replaces every occurrence of symbolic constant PI with a value 3.14159 before the program is compiled.
Conditions & Feautres :
- All preprocessor directive must begin with hash sign (#)
- preprocessor directive should not end with semicolon because they are not C++ statement.
- Only one preprocessor directive can occur in a line.
The execution of the program always starts from this part of the program. It includes local declaration part and executable part. The local declaration part includes the declaration of variable that can only be accessed within the main( ).
Example :
#include<iostream.h>
#include<conio.h>
int main( )
{
cout<<"This is my First C++ Script";
getch ( );
return 0;
}
OUTPUT :
This is my First C++ Script