The "Hello World" program is the simplest program one can write in a programming language. It is the very first step towards learning a programming language. In this short guide, we'll learn to build a simple "Hello World" program.
Purpose
Write a program to print " Hello World " in console.
#include <iostream>
using namespace std;
int main()
{
printf("Hello World!");
return 0;
}
Explanation
The Hello World program is simple, it just displays Hello World text in console. The program requires the iostream
header file as the printf()
function is defined within it. The printf()
function prints whatever string argument is fed into it. Thus feeding a "Hello World!" string outputs Hello World! in the console.