/******************************************************************************************** example 9 -- timetest.cpp making military time into clocktime ********************************************************************************************/ #include <iostream> using namespace std; #include "clocktime.h" void paces(clocktime& mt); void main() { //no arguments clocktime mtTest; paces(mtTest); //create using arguments clocktime mtTest2(3,15); //3:15 am paces(mtTest2); cout << "Add the first to the second: "; mtTest2.addSame(mtTest); cout << mtTest2 << endl; cout << "Set a third equal to the sum of the first two: "; clocktime mtTest3 = mtTest2 + mtTest; cout << mtTest3 << endl; } void paces(clocktime& mt) { //putting the object through it's paces... cout << "Start: " << mt << endl; mt.showAMPM(); cout << " " << mt << endl; mt.showAMPM(false); int i; for (i = 0; i < 15; i++) { cout << "Add 5s: "; mt.addSecond(5); cout << mt << endl; } for (i = 0; i < 15; i++) { cout << "Add 5m: "; mt.addMinute(5); cout << mt << endl; } for (i = 0; i < 15; i++) { cout << "Add 1h: "; mt.addHour(1); mt.show24H(i%2); cout << mt << endl; } }