Sdut Object-Oriented Programming Practice 5 (simple class and object)
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
Using namespace std; // declare class type class time {// define private part private: int h; int m; int s; // define public part public: void settime () // assign the member function {cin> h> m> s;} void showtime () // output the member function {cout <