Hw-4 / Exam-2 and Grades:
Math 110
ID hw1 hw2 exam1 hw3 hw4 exam2 hw5 hw6 exam3 hw7 hw8 exam4 final
074 19/ 14/ 70/ 11/
706 20/ 13/ 90/ 13/
550 20/ 14/ 96/ 17/
293 18/ 14/ 70/ 13/
301 19/ 15/ 97/ 17/
183 19/ 14/ 78/ 13/
534 19/ 15/ 73/
588 19/ 14/ 83/ 13/
Max 20/ 15/ 100/ 15/
// Exercise 3.26 Solution
#include <iostream>
using std::cout;
using std::endl;
using std::cin;
unsigned seconds( unsigned, unsigned, unsigned );
int main()
{
unsigned hours, minutes, secs, temp;
cout << "Enter the first time as three integers: ";
cin >> hours >> minutes >> secs;
temp = seconds( hours, minutes, secs );
cout << "Enter the second time as three integers: ";
cin >> hours >> minutes >> secs;
cout << "The difference between the times is "
<< seconds( hours, minutes, secs ) - temp
<< " seconds" << endl;
return 0;
}
unsigned seconds( unsigned h, unsigned m, unsigned s )
{
return 3600 * ( h >= 12 ? h - 12 : h ) + 60 * m + s;
}