// A data type for times -- aggregation #include using namespace std; struct Time { int hours; int minutes; }; void read(Time& t, istream& in = cin) { in >> t.hours; in.ignore(); // colon in >> t.minutes; } void print(const Time& t, ostream& out = cout) { out << t.hours << ':'; if (t.minutes < 10) { out << 0; } out << t.minutes; } // Test driver for Time int main() { Time t; read(t); print(t); cout << endl; read(t, cin); print(t, cout); cout << endl; return 0; }