Name: ____________________________________________________ Alpha: ________________________

Describe help received: _____________________________________________________________________
See the bottom for how to submit your work.

Due: Before 0800 on next class day

  1. (10 pts) Read the lecture notes for today carefully. Read the programming guide and tips. Honestly declare how you read the notes.
    1. (10 pts) I read the notes carefully. I have a good understanding of the topics therein.
    2. (10 pts) I read the notes carefully, but I don't really understand the following points well:
      
      
      
      
    3. (0 pts) I didn't read the notes carefully.
  2. (4 pts) What's the output of the following code snippet?
    
    cout << 3/4 << endl;
    cout << 20 % 7 << endl;
    
  3. (10 pts) What is the type of each of the following values?
     -0      0.0     '0'    "-0.0"       false 
  4. (16 pts) Fill out the table
    CodeUser InputProgram OutputUnread Input
    char c;
    cin >> c;
    cout << c << endl;
    103.07%
    int k;
    cin >> k;
    cout << k << endl;
    103.07%
    double x;
    cin >> x;
    cout << x << endl;
    103.07%
    string s;
    cin >> s;
    cout << s << endl;
    103.07%
  5. (60 pts) Write a program hw.cpp 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 length is always larger than the second! Note that to represent the unit of inches, we use two single-quotation marks instead of one double-quotation mark.

    A typical run of your program should look like this (user input shown in red):

    Enter two lengths in feet and inches (larger first!)
    32' 6''
    15' 11''
    Difference is 16' 7''
Turn in (Due: 0800 on the next class day)