• Have Any Question?
  • contact@eitworld.com

cpp program

C++ Program

We are going to learn a simple C++ program in this section. Following is our first C++ program that prints “Hello C++” on the screen:


int main()


cout<<“Hello C++”;

return 0;



Hello C++

Now we are going to explain the every statement of the above program here:

  • # include is a header file. Here # is used to represent the preprocessor directive. In iostream.h io stands for input output and .h stands for header file. #include should be included in every C++ program.
  • main() function should be necessarily added in every c++ program because execution of every c++ program begins with the main() function. { is the opening braces for main and } is the closing braces. All statements and instructions are written inside the main() function. int before main() function is termed as its return type. We can also use void as return type for main() function.
  • cout is an output function. Which display everything written within the double quotes.
  • return 0; shows the value return by the main() function.

Compilation and Execution of C++ program

To execute a compile and execute a C++ program follow the given steps:

  • Open a C++ editor that is TurboC3 Compiler.
  • Now write the above code in the C++ editor.
  • To compile a C++ program press key Alt+F9. If the program is error free then it will successfully compile the program otherwise it shows the error-list. Now to run the program we have to use the Ctrl+F9 key.
  • Now to execute program successfully remove error from the program and can see the console screen by pressing Alt+F5 key. It shows over all message present on the console and these message can be from other program if we are not using clrcsr() function.

Real Time Web Analytics