Week 3

This week, we learned the basic rules of C++ including literals, identifiers, symbols, variables, arithmetic operators, assignment, standard input/output (cin/cout). These topics are mainly from Chapter 2 of the textbook (Tapestry).  However, input stream (cin), variables, data types and arithmetic operators are in Sections 3.1 and 3.2. Assignment operator is discussed in Section 4.1.

Then we continued with other basic data types such as char, double and other versions of int. We covered limits of these data types and discussed integer overflow. We also covered some more arithmetic operations and operator precedence. We could not have time to finish some more assignment operators (last two slides of bascis2.ppt); we will cover them next week. We  could not cover the fahrcels.cpp file in class either but we will cover it in the recitations this week. These are in basics2.ppt file below. Topics are mostly from Chapter 3 of the textbook (up to section 3.4), but it includes assignment operator which is in Chapter 4 of the book. Integer and real representation and limits are not detailed in the book. short, signed, unsigned are not explained in the book either.

Some example programs (such as area.cpp, time.cpp and time2.cpp) are not in the book. However, these programs are given below.

The .swf file (animation) should be copied to the same folder as the basics.ppt file.
 

Powerpoint files and animations
basics.ppt
basics2.ppt

cin.swf

C++ codes discussed in class (some of them might have been modified in class to show extra features)

area.cpp
daysecs.cpp

fahrcels.cpp (to be covered in recitations)

time.cpp   (not covered in class but good to have a look at as an extra example)
time2.cpp   (not covered in class but good to have a look at as an extra example)