< previous page page_a52 next page >

Page A52
       else
       {
           cout << A is too large. << endl;
           b = 3;
       }
   else
       cout << A is too small. << endl;
   cout << All done. << endl;
Chapter 5
Case Study Follow-Up
1. if (temperature > 85)
       cout << swimming.;
   else if (temperature > 70)
       cout << tennis.;
   else if (temperature > 32)
       cout << golf.;
   else if (temperature > 0)
       cout << skiing.;
   else
       cout << dancing.;
   cout << endl;
5. Use a nested If structure to eliminate the redundant testing.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
if ( ! (code == L || code == P) )
    cout << The item code is invalid. << endl;
else if (code == L)
{
    // Calculate lumber amount
    .
    .
    .
}
else
{
    // Calculate plywood amount
    .
    .
    .
}
Chapter 6
Exam Preparation Exercises
3. number = 1;
   while (number << 11)
   {
       cout << number << endl;
       number++;
   }

 
< previous page page_a52 next page >