#include "Time.h" #include using namespace std; int main() { Time time1(19, 36, 11); Time time2(17, 44, 29); cout << "time1: " << time1.ToString() << endl; cout << "time2: " << time2.ToString() << endl << endl; // Test the relational operators in Question 2. cout << "Relational operators..." << endl; cout << "time1 == time2: " << (time1 == time2) << endl; cout << "time1 != time2: " << (time1 != time2) << endl; cout << "time1 > time2: " << (time1 > time2) << endl; cout << "time1 >= time2: " << (time1 >= time2) << endl; cout << "time1 < time2: " << (time1 < time2) << endl; cout << "time1 <= time2: " << (time1 <= time2) << endl << endl; // Test the mathematical operators in Question 3. cout << "Mathematical operators..." << endl; cout << "time1 + 15: " << (time1 + 15).ToString() << endl; cout << "time1 - 15: " << (time1 - 15).ToString() << endl; cout << "time1 - time2: " << (time1 - time2) << endl; time1 += 30; cout << "Result of (time1 += 30): " << time1.ToString() << endl; time1 -= 20; cout << "Result of (time1 -= 20): " << time1.ToString() << endl; cout << "++time1: " << (++time1).ToString() << endl; cout << "time1++: " << (time1++).ToString() << endl; cout << "time1 now: " << time1.ToString() << endl; cout << "--time1: " << (--time1).ToString() << endl; cout << "time1--: " << (time1--).ToString() << endl; cout << "time1 now: " << time1.ToString() << endl << endl; // Test the additional operators in Question 4. Time anotherTime; cout << "Please enter another time (h m s): "; cin >> anotherTime; cout << "The time is " << anotherTime << endl; if (!anotherTime) { cout << "The time is false (i.e. midnight)." << endl; } else { cout << "The time is not false (i.e. not midnight)." << endl; } return 0; }