#include //The #include is a "preprocessor" directive that tells the //compiler to put code from the header called iostream into //our program before actually creating the executable. //By including header files, you an gain access to many //different functions. using namespace std; //This line tells the compiler to use a group //of functions that are part of the standard //library (std). By including this line at the //top of a file, you allow the program to use //functions such as cout. The semicolon is part //of the syntax of C and C++. It tells the //compiler that you're at the end of a command. //You will see later that the semicolon is used //to end most commands in C++. int main() //This line tells the compiler that there is a //function named main, and that the function //returns an integer, hence int. { //The "curly braces" ({ and }) signal the //beginning and end of functions and other code //blocks. Similar to BEGIN and END. cout<<"Hello world\n"; //The cout object is used to display text. It //uses the << symbols, known as "insertion //operators", to indicate what to output. //cout<< results in a function call with the //ensuing text as an argument to the function. //The quotes tell the compiler that you want to //output the literal string as-is. The '\n' //sequence is actually treated as a single //character that stands for a newline. It moves //the cursor on your screen to the next line. //The semicolon is added onto the end of all, //such as function calls, in C++. cin.get(); //This is another function call: it reads in //input and expects the user to hit the return key. //Upon reaching the end of main, the closing //brace, our program will return the value of 0 //(and integer, hence why we told main to return //an int) to the operating system. This return //value is important as it can be used to tell //the OS whether our program succeeded or not. }