Gavin Wiggins

About  /  Notes  /  Photos

Hello world

Written on December 13, 2022

Here is a simple example of a C++ program in a file named helloworld.cpp.

// helloworld.cpp

#include <iostream>

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

Use the terminal command shown below to build and run the program. You should see the words Hello world! printed in the terminal.

clang++ helloworld.cpp -o helloworld; ./helloworld

Gavin Wiggins © 2024.
Made on a Mac with Genja. Hosted on GitHub Pages.