/******************************************************************************************** ex0.cpp Developing the military time class ********************************************************************************************/ #include <iostream> using namespace std; //class definition class miltime { public: int hour; // 0-23 int minute; // 0-59 int second; // 0-59 }; void main() { miltime t; if (t.hour < 10) cout << '0'; cout << t.hour << ':'; if (t.minute < 10) cout << '0'; cout << t.minute << ':'; if (t.second < 10) cout << '0'; cout << t.second << endl; //Add 30 seconds to it and reprint it t.second += 30; if (t.hour < 10) cout << '0'; cout << t.hour << ':'; if (t.minute < 10) cout << '0'; cout << t.minute << ':'; if (t.second < 10) cout << '0'; cout << t.second << endl; //Add 30 minutes to it and print it t.minute += 30; if (t.hour < 10) cout << '0'; cout << t.hour << ':'; if (t.minute < 10) cout << '0'; cout << t.minute << ':'; if (t.second < 10) cout << '0'; cout << t.second << endl; //Add 30 hours to it and print it t.hour += 30; if (t.hour < 10) cout << '0'; cout << t.hour << ':'; if (t.minute < 10) cout << '0'; cout << t.minute << ':'; if (t.second < 10) cout << '0'; cout << t.second << endl; }