Getting Started

types, variables, expressions, statements, and functions. compile and execute.

The way to learn a new programming language is to write programs.

  • Define variables
  • Do input and output
  • Use a data structure to hold the data
  • Test whether two records have the same ISBN
  • Contain a loop that will process every record in the transaction file

C++ Program

  • return type
  • function name
  • parameter list
  • function body

Compiling and Executing

1
2
3
4
# GNU
g++ -o prog1 prog1.cc
# Windows
cl /EHsc prog1.cpp

A First Look at Input/Output

iostream (istream + ostream)
cin, cout, cerr, clog

Flow of Control

1
2
3
4
5
6
7
8
9
10
11
12
13
14
while ( condition )
{
body;
}

for ( init ; condition ; operation )
{
body;
}

if ( condition )
{
body;
}

Class

who, where, what