First C++ program

/* Program to print something. */

#include<iostream.h>

#include<conio.h>

void main()

{

/* printing hello*/

cout<<“hello”;

getch();

}

Description: this is our first c program which printing the hello.

In first line we have given the comments ‘/*………*/’. We can give comments like that, at any place in the program.

In the next two lines we are defining the header files which are in our c library and provides the help for input output in the program.

In next line we used ‘main()’ which tells the compiler from where execution of program will begins and it is an user defined function. And we have used void that means its return type is void and we don’t want to return any value.

In next line we have the ‘{‘ which means block of a function is starting.

Then in next line we printed the hello. The ‘cout’ is use to print any thing And we use ‘;’ which is used to terminate the line.

Then we have use ‘getch()’ function which is use to hold the screen till any button is pressed.

And again we used ‘}’ to close the ‘main()’ function.

Leave a Reply

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