< previous page page_90 next page >

Page 90
11. What does the following program print?
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
#include <iostream.h>

const int LBS = 10;

int main()
{
    int price;
    int cost;
    char ch;

    price = 30;
    cost = price * LBS;
    ch = A;
    cout < Cost is  < endl;
    cout < cost < endl;
    cout < Price is  < price <Cost is  < cost < endl;
    cout < Grade  < ch <  costs  < endl;
    cout < cost < endl;
    return 0;
}
Programming Warm-up Exercises
1. Change the program in Exam Preparation Exercise 11 so that it prints the cost for 15 pounds.
2. Change the program in Exam Preparation Exercise 11 so that the price is a named constant rather than a variable.
3. Write three consecutive output statements that print the following three lines:
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
The moon
is
blue.
4. Enter the following program into your computer and run it. In the initial comments, replace the items within parentheses with your own information. (Omit the parentheses.)
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
//***********************************
// Programming Assignment One
// (your name)
// (date program was run)
// (description of the problem)
//***********************************
#include <iostream.h>

 
< previous page page_90 next page >