Low Orbit Flux Logo 2 F

C++ Hello World

A “hello world” program refers to the most basic example or demo of a program that could possibly exist. This is usually the first thing that you will try when learning a given programming language. It shows that you can actually get something to run and that all of the tools are working.

This is the code for a basic C++ hello world program:


#include <iostream>

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

The above is pretty simple but not as simple as some languages. The output syntax is a bit messy and could be a bit confusing to a beginner. The equivalent program in Java or C will be a bit cleaner. If you were to use something like Python or Ruby you would be able to implement this in a single line. That single line would be a little bit easier to understand because it would just be calling a function with a name like “print”.