First C++ Program

First C++ Program Example

/* first C++ program */

/* Required Header files are 1st included */

#include<iostream.h>

/* Every C++ program starts with a main function. The function type is defined as “int” here. We will study function types in detail in further chapters. */

int main()
{
/* The function printf is used to display output on the screen. */
cout<<
“Hello, World!\n”;

return 0;   /* As we have declared an int function so it must return some integer value */
}

This program prints – Hello World – on the screen and takes the cursor to next line. \n is used to break line and move the cursor to next line.

Leave a Reply

Your email address will not be published. Required fields are marked *