CPS 6, Ramm - Summer Semester I - 5/27/99 #6
- Announce
- Coin Toss for Random Quiz #3
Chapt 4. Building Programs & Solving Problems
- 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
- Use Functions Like Variables
- Writing
string Functions
getgrade.cc
getgradealt.cc
- Design Different "Curving" Functions
- Writing Functions
Design Different "Curving" Functions
- Look at
numtoeng.cc in Book
- The
string Member Functions
string demo = "Monday morning";
- length:
int length()
demo.length() == 14
- Substring:
string substr(int pos, int len)
demo.substr(7,4) == "morn"
- Contains:
bool Contains(string s)
demo.Contains("day") == true
- Find:
int find(string s)
demo.find("y m") == 5
- Lower Case:
string Downcase()
demo.Downcase() == "monday morning"
- Upper Case:
string Upcase()
demo.Upcase() == "MONDAY MORNING"