Name: ____________________________________________________ Alpha: _____________________

Describe help received: _________________________________________________________________

  1. [10pts] Assume the following declarations. Next to each of the bulleted expressions, write the type and value of the result.

    int n = 5;
    double x = 1.5;
    char c = 10*n + 2;
  2. [10pts] Explain why cout << (3.5*5)/4 results in 4.375 being printed to the screen, but cout << 3.5*(5/4) results in 3.5 being printed to the screen.

    
    
    
    
    
  3. [80pts] Write a program that reads in two lengths in the format x' y" (i.e. x feet y inches) and returns the difference in length between the two in the same format. You may assume that the first is always larger than the second! A typical run of your program should look like this (2nd and 3rd lines are user input):

    Enter two lengths in feet and inches (larger one first!)
    32' 6"
    16' 7"
    Difference is 15' 11"

    Hints!

Turn in a printout of this cover sheet with your answers to the questions, your source code, and a screen capture of your program running.