Tutorial, continued

Here is some more code.  You should start with the first one, and type each one into a text document and compile it.  Then change something, play around with the code, and recompile to see how things work.  If you mess something up (like forgetting a semicolon or a closing quote), the compiler will give you some error messages and it won't create your program.  You need to fix the errors and recompile.

One note: you need to end each "statement" with a semicolon.  int main() is not a statement (it's a function), and neither is #include <iostream.h> (it's a preprocessor directive), so they don't end with semicolons.  But cout << "blah blah blah"; and return 0; are statements, so at the end of them, you need a semicolon.  Note that a statement can span more than one line, so every line doesn't necessarily end with a semicolon.

If all that's confusing, just check out the code and you'll see.

code02.cpp:

Teaches some basic text formatting, including newlines (\n and endl) and tabs (\t).  Also explains comments.

code03.cpp:

Teaches variable usage, and how to input keyboard data (with cin).

View some programs that I've written