Define a class Time
that has three data members hour
, min
, and sec
of int
type. All data members MUST NOT be declared public
. Overload necessary operators to make the following main()
work. The I/O format for >>
and <<
follows the standard time format: 11:23:17
, which represents 11
o'clock 23
minutes 17
seconds. Do not change main()
, otherwise you may lose penalty points!! Submit everything including main()
.
int main() { //DO NOT CHANGE MAIN
Time t1, t2(10, 3, 27);
cout << t1 << endl << t2 << endl;
cin >> t1;
cout << t1 << endl;
return 0;
}
5:23:30
0:0:0
10:3:27
5:23:30