Hello, World! Part 1

Your First C++ Program



A C++ program is a collection of commands or statements.

Below is a simple code that has "Hello world!" as its output.
#include <iostream>
using namespace std;

int main()
{
cout << "Hello world!";
return 0;
}
Try It Yourself

Let's break down the parts of the code.#include <iostream>
C++ offers various headers, each of which contains information needed for programs to work properly. This particular program calls for the header <iostream>.
The number sign (#) at the beginning of a line targets the compiler's pre-processor. In this case, #include tells the pre-processor to include the <iostream> header.
The <iostream> header defines the standard stream objects that input and output data.

Comments