Monday 6 July 2015

First C++ Program:


#include<iostream.h>                            //////This is the Header File

void main(){                                          //////Main body start with curly braces "{"
clrscr();                                                  ////// This function clear the screen

cout<<"My First Program.";                  /////The message is shown on the screen

getch();                                                  /////Hold the program on the screen

}                                                            /////Main Body ends with curly braces "}"

Output:


         My First Program.

Explanation of First Program:

  1. "///////" such lines are used for comments in Turbo which is ignored by compiler.
  2. Comments are written for user understanding.
  3. C++ Insertion operator (<<) is used to display value to the user on the console screen.

No comments:

Post a Comment