CPS 6, Ramm - Summer Semester I - 5/26/99 #5
- Announce
- Random Quiz #3
- Assignment #2
Chap 3: C++ Programs: Input/Process/Output
- Balloon Example (need for labs)
use figures from book (pp. 99-104)
fly.out
actual program:
fly.cc
- Member Functions
methods
actions
.Ascend()
.Cruise()
.Descend()
- Information Hiding
- Header Files
- Interface Diagram
- Reading the Header File (p. 103)
- Public
- Private
- Private Variables: State
balloon.h
- Compiling and Linking
Chapt 4. Building Programs & Solving Problems
-
if Statement
if ( test expression )
{
statement list;
}
-
if/else Statement
if ( test expression )
{
statement list;
}
else
{
statement list;
}
-
if/else Examples:
- Relational Operators
| == | equal to
|
| > | greater than
|
| < | less than
|
| != | not equal to
|
| >= | greater than or equal to
|
| <= | less than or equal to
|
- Value of Relational Operations
true = 1
false = 0
- Logical Operators
- Short Circuit Evaluation
exhaust4.cc
- C++ Operator Precedence
| ! | NOT
|
| *, /, % | mult, div, mod
|
| +, - | add, subt
|
| <<, >> | insert, extract
|
| <, <=, >, >= | LT, LE, GT, GE
|
| ==, != | EQ, NE
|
| && | AND
|
| || | OR
|
| =, +=, -=, *=, /=, %= | assignment
|
When in doubt, parenthesize
- Functions that Return Values
math.cc
- Writing
Double Functions
tfuncts.cc