#include using namespace std; class Time { public : int hour, minute , second; }; void print24(Time t) { cout << ( t.hour < 10 ? "0" : "" ) << t.hour << ":" << ( t.minute < 10 ? "0" : "" ) << t.minute << ":" << ( t.second < 10 ? "0" : "" ) << t.second; } void print12(Time t) { cout << ( ( t.hour == 0 || t.hour == 12 ) ? 12 : t.hour % 12 ) << ":" << ( t.minute < 10 ? "0" : "" ) << t.minute << ":" << ( t.second < 10 ? "0" : "" ) << t.second << ( t.hour < 12 ? " AM" : " PM" ); } int main() { Time t; t.hour = 22; t.minute = 30; t.second = 0; cout << " Match of the day is at "; print24(t); cout << " in a 24 hour clock or "<< endl ; cout << " " ; print12(t); cout << " in a 12 hour clock" << endl; return 0; }