Due: Before 0800 on next class day
cout << 3/4 << endl;
cout << 20 % 7 << endl;
-0 0.0 '0' "-0.0" false
| Code | User Input | Program Output | Unread 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% |
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''
"'"
works just fine, but to get the character constant of the
apostrophe you must write '\'', which uses the
backslash as an escape character.
~/bin/submit -c=IC210 -p=hw03 hw.cpp