Write a C++ program to print "HELLO WORLD".

In this blog I start with one of the most basic program of C++ programming. I will discuss all the line of code of this program one by one with their meaning and use in the program

Program Code:

#include<iostream>
using namespace std;
int main()

{
cout << "Hello World!";
return 0;
}

The program output is tested on www.jdoodle.com

Output:
Hello World!

Explanation of the program Code:

1. #include<iostream> : This is the header fill which is used to connect our program code with the compiler. It contain all the input and output function of the program.

2. using namespace std : All the elements of the standard C++ library are declared within a namespace. In this case the namespace with the name std. We put this line in to declare that we will make use of the functionality offered in the namespace std. 

3. int main() : Here main() is the function from where the execution of the program start and int is the return type of the function. The word main is followed by a pair of round brackets.

4. cout <<: It represents the standard output stream in C++. In this a sequence of characters  will be send to the standard output stream and this sequence of character will be in (" ") and sentence should be terminated with (;).


5. return 0 :In this program the return statement causes the main function to finish. You may return a return code but it depends on how you start your function main( ).


Thanks
Mukesh Rajput


Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: