Hello World! program in C++

By | October 19, 2024

Problem statement :
Start from the famous 'Hello World' code. This program prints 'Hello World' when executed.

Explanation :
The 'Hello World' is a common or simple example to check compiler and library presence. It has minimum chances of user error (during compilation), because it has only one file to compile.

This simple program uses the C++ standard library, with std::cout from <iostream>.

Code :

#include <iostream>

// Driver
int main()
{
    // Your first program
    std::cout << "Hello World!" << std::endl;
}

Output :
The output of the program should be −

Hello World!

Author: Mithlesh Upadhyay

Mithlesh Upadhyay is a Computer Science and AI expert from Madhya Pradesh with strong academic background (BE in CSE and M.Tech in AI) and over six years of experience in technical content development. He has contributed tech articles, led teams, and worked in Full Stack Development and Data Science. He founded the w3colleges.org portal for learning resources.