HELLO WORLD PROGRAM AND EXPLANATION
• Hello world program
# include<iostream.h>
#include<conio.h>
// pre-processor directives ,header files
Void main ()
// main () is where program execution start
{
Clrscr ();
//its clear output of the previous program.
Cout<<”HELLO WORLD”;
// prints hello world .
Getch();
//its hold the output screen of the program.
}
OutPut
HELLO WORLD
• Header files
Header file is the definition of all input and output function like cin>> ,cout<<; ,getch();
1. #include<iostream.h>
Iostream stand for input output stream .cin>> cout<< whenever these functions are invoked program there definition taken from this file by complier
2. #include<conio.h>
Conio stand for Console input output .Commanly used function of conio.h Clrscr(); getch();
• Void main ()
Void main(); is the starting point of the program when program complied the compiler search for main () then after remained program is compiled.
• Clrscr();
Its working is written in conio.h header file .This function clear output screen of previous program.
• Cout<<
Its definition in iostream.h header file .its used for print the written text in double quotes “HELLO WORLD “
Cout<<” HELLO WORLD “;
• Cin>>
Its definition in iostream.h and it accepts the input given by the user
For eg.
Void main ()
{
Int a;
Cin>>a;
}
• Getch();
Getch(); is used to hold the output screen until you don’t press any key.
• Comments
Comments are the text written by the programmer for programmer to understand cod
Comments are tow type
Single-line comment
// This is example of single line comment.
Multiple line comment
/*
This is example of multiple line comment
*/
• Hello world program
# include<iostream.h>
#include<conio.h>
// pre-processor directives ,header files
Void main ()
// main () is where program execution start
{
Clrscr ();
//its clear output of the previous program.
Cout<<”HELLO WORLD”;
// prints hello world .
Getch();
//its hold the output screen of the program.
}
OutPut
HELLO WORLD
Explanation
Above program is the simple c++ program which prints “HELLO WORLD”.• Header files
Header file is the definition of all input and output function like cin>> ,cout<<; ,getch();
1. #include<iostream.h>
Iostream stand for input output stream .cin>> cout<< whenever these functions are invoked program there definition taken from this file by complier
2. #include<conio.h>
Conio stand for Console input output .Commanly used function of conio.h Clrscr(); getch();
• Void main ()
Void main(); is the starting point of the program when program complied the compiler search for main () then after remained program is compiled.
• Clrscr();
Its working is written in conio.h header file .This function clear output screen of previous program.
• Cout<<
Its definition in iostream.h header file .its used for print the written text in double quotes “HELLO WORLD “
Cout<<” HELLO WORLD “;
• Cin>>
Its definition in iostream.h and it accepts the input given by the user
For eg.
Void main ()
{
Int a;
Cin>>a;
}
• Getch();
Getch(); is used to hold the output screen until you don’t press any key.
• Comments
Comments are the text written by the programmer for programmer to understand cod
Comments are tow type
Single-line comment
// This is example of single line comment.
Multiple line comment
/*
This is example of multiple line comment
*/
Comments
Post a Comment