Enter the code:
/**copyright (c) 2015, College of Computer and Control engineering, Yantai University *all rights reserved.* file name: sum123.cpp* Author: Lin Haiyun * Completion date: March 17, 2015 * version number: v2.0** problem Description: Read , after running the program, expand the functionality of the class as required, on the basis of the original class, add the following member functions within the class (will be built-in member functions) ADD_A_SEC ()//Add C seconds add_a_minute ()//Increase B min add_an_hour ()//Add a hour in main () number, call the newly added member function to test the expanded functionality. * Program input: Time. * Program output: The time after the change. */#include <iostream>using namespace Std;class time{public:void set_time (); void Showtime (); void add_a_sec (int n); void Add_a_minute (int n); void Add_an_hour (int n);p rivate:bool is_time (int, int, int); int hour; int minute; int sec;}; void Time::set_time () {char c1,c2; cout<< "Please enter the correct time format (HH:MM:SS):"; while (1) {cin>>hour>>c1>>minute>>c2>>sec; if (c1!= ': ' | | c2!= ': ') cout<< "The input time format is not correct, please re-enter:"; else if (!is_time (hour,minute,sec)) cout<< "The time entered is illegal, please re-enter:"; else break; }}bool time::is_time (int h, int m,int s) {if (h<0| | h>24| | m<0| | m>60| | S<0|| S>60) return false; else return true;} void Time::showtime () {cout<
Operation Result:
Time Class (Increase N)