Object-Oriented Programming machine practice 5 (class and object) Time Limit: 1000 ms memory limit: 65536 K The topic description defines the class time. The time has three common data members, hour, Min, and SEC, which respectively indicate hours, minutes, and seconds.
Define the time Class Object T1 in the main function, input the data members of T1 in the main function, and then output the data members. Enter the three data members hour, Min, and SEC of the input class object. Output three data members hour, Min, and SEC of the output class object. Sample Input
9 10 11
Sample output
9:10:11
# Include <iostream> using namespace STD; // declare class type class time {// define private part private: int h; int m; int s; // define public part public: void settime () // value assignment member function {CIN> H> m> S;} void Showtime () // output member function {cout <H <": "<m <": "<S <Endl ;}; // do not forget this semicolon // main function int main () {class time t; t. settime (); T. showtime (); Return 0 ;}
Sdut Object-Oriented Programming Practice 5 (simple class and object)