13808 - EE2310_Final_3   

Description

Define a derived class GlobalTime from Time that includes an int representing the offset of a time zone with respect to the Greenwich Mean Time. For example, Taiwan's time zone is GMT+8, and we store this extra data member +8 in GlobalTime. Overload related operators and implement related member functions to make the following main() work. You can modify the Time class but you cannot declare data members in public section in any class (otherwise you'll lose penalty points.) Do not change main(), otherwise you will lose penalty points, too.

int main() { // DO NOT CHANGE MAIN !!!
    GlobalTime gt1(10, 3, 27, 3), gt2;
    cin >> gt2;
    Time &t1 = gt1;
    t1.output();
    cout << endl;
    Time &t2 = gt2;
    t2.output();
    cout << endl;
    return 0;
}
 

Input

11:13:7-8

Output

10:3:27+3
11:13:7-8

Sample Input  Download

Sample Output  Download

Tags




Discuss