Tom Kelliher, CS18
Feb. 9, 1996
Example: If the account balance is negative, penalize the account.
Example: If the grade is greater than or equal to 60, print PASSED, otherwise print FAILED.
Example: If the day number is one, print Monday, if the day number is two, print Tuesday, etc.
What roles can the final else play?
1) if (50 <= 65 <= 60)
cout << "True" << endl;
else
cout << "False" << endl;
2) i = 0;
if (i = 3)
cout << "True" << endl;
else
cout << "False" << endl;
3) i = 0;
if (!(i = 3) == 1)
cout << "True" << endl;
else
cout << "False" << endl;
Truth tables for single, multiple &&'s and ||'s, !.
In what subtle, but important, ways does a switch differ from a multiway if/ else?
Consider converting numerics grades to letter grades. Compare and contrast the two multiway selection structures.