< previous page page_a48 next page >

Page A48
11. Cost is
    300
    Price is 30Cost is 300
    Grade A costs
    300
Chapter 2
Programming Warm-Up Exercises
1. Only one line needs to be changed. In the constant declaration
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
const int LBS = 10;
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
change 10 to 15.
3. cout << The moon << endl;
   cout << is << endl;
   cout << blue. << endl;
Chapter 2
Case Study Follow-Up
1. The named constants make the program easier to read and understand. Also, to change one of the constants, you only need to change one line (the constant declaration) instead of changing every occurrence of the literal constant throughout the program.
Chapter 3
Exam Preparation Exercises
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
1. a. Floating point: 13.3333 b. Integer: 2 c. Integer: 5 d. Floating point: 13.75 e. Integer: -4 f. Integer: 1 g. Illegal: 10.0 /is a floating point expression, but the % operator requires integer operands.
5. a. iostream.h b. stdlib.h c. math.h d. iostream.h e. iostream.h and iomanip.h
9. A rolling
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
stone
¼ One blank line
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
gathers
¼ Three blank lines
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
nomoss

11. False
Chapter 3
Programming Warm-Up Exercises
1. sum = n * (n + 1) / 2;

 
< previous page page_a48 next page >