This is a typical C++ Hello World program. Here's the explanation what I have used in this program. In first two lines, I have used iostream and conio header's files of C++. In line no. 3, I have declared C++ main class that is void main(). After that I have used clrscr(); which is used to clear the screen of a C++ window. In line no. 6,7 and 8, I have used cout which is used to print a message. In C++, endl is used to end a line and getch(); is used to stop a screen of a C++ window so that a user can see what message got printed on window.
1: #include<iostream.h>
2: #include<conio.h>
3: void main()
4: {
5: clrscr();
6: cout<<"Hello World!";
7: cout<<endl;
8: cout<<"This is my first C++ program.";
9: getch();
10: }
Output of the program is :
Hello World!
This is my first C++ program.
No comments:
Post a Comment