Whats in this post?
- Background and Explanation of the code
To copy code: Click “View Source” on the right of this code snippet.
Background and Explanation of the code
In the above program, class time is declared with three private data members hh, min and sec and three private member functions sethour ( ), setmin ( ), setsec ( ) to set hours, minutes and seconds respectively.When an object t of class time invokes input_time ( ) function, the user is prompted to input hours, minutes and seconds.Then it displays time in proper universal format.
Enter time : 12
Time entered is 12:12:34