code/misc/hello.cpp

This is the very first C++ program you should try to compile and run! It just prints "Hello world!" to the console (cout). At the top of the file comes a #include statement that pulls in some code we need from other places: more on this later. Next we "use" namespace std, which saves us from some typing: again, more will be explained on this later.

                
#include <iostream>
using namespace std;

                

main() is the starting place of every C++ program. In this program, we have no functions but main.

                
int main() {
    cout << "Hello world!\n";
}