Computer Studies‎ > ‎

C++ (The New Boston Tutorial)

The New Boston has two series of C++ tutorials available, the first at, and the second, which I have chosen to profile, at

I'm having a look at a few of them and making some notes to see if they'd be useful in class.  

Update: I've chosen not to pursue this further, not because of the quality of the videos, but because I'm placing my emphasis on other languages instead.

Installing Code:Block

  • Download and install codeblocks-10.05mingw-setup.exe (or more current version) from (IDE and compiler)
    • See website for Apple or Linux versions
  • Create default Console application (Hello World)

Understanding a Simple C++ Program

  • Understand the Hello World programming created above
    • #include <iostream> 
      • is a pre-processor directive
    • Use of whitespace (tabs, spaces, and blanks lines do not affect compilation)
    • using namespace std; 
      • includes a library
    • int main()
      • the program always starts here!
      • note that the syntax (i.e., use of parentheses "()", semi-colons ";", braces "{}", etc. is critical) or program will not work
    • cout << "Hello world!" << endl;
      • prints "Hello World!" to the output console, followed by an EOL (new line) character

More on Printing Text

  • all statements end with semi-colons
  • << endl used to start a new line in the output stream
  • \n can also be used to start a new line
  • Note: to prevent the console from closing automatically when running the exe programs outside of the IDE, insert cin.get(); at the end of your program

Come Get Sum!

  • an integer variable can be declared as follows:
    int nameOfVariable;
  • input from the keyboard can be stored in a variable like this:
    cin >> nameOfVariable;