C++ Program to Program to Print Hello World

34
views
Hello World
(Last Updated On: September 1, 2018)

In this Program example, you will learn to print Hello World.

In this program, you’ll learn to print Hello World using input and output functions.

The Hello World program is one of the simplest programs, but it already contains the fundamental components that every C++ program has. Don’t be overwhelmed, we will take a look at the code line by line.

Program to print Hello World!

#include <iostream>
using namespace std;

int main() 
{
    cout << "Hello, World!";
    return 0;
}

Output

Hello, World!

Note: Every C++ program starts from the main() function.

The cout is the standard output stream which prints the “Hello, World!” string on the monitor.

The return 0; is the Exit status” of the program.

Program to Print Hello World! using std function

#include <iostream>

int main() 
{
    std::cout << "Hello, World!";
    return 0;
}

Output

Hello, World!

Related Program

Ask your questions and clarify your/others doubts on how to print statement by commenting. Documentation.

Please write to us at [email protected] to report any issue with the above content or for feedback.