01/* 02. * copyright and version Declaration of the program part 03. * Copyright (c) 2013, Yantai University Computer college student 04. * All rightsreserved. 05. * file name: circlee. cpp 06. * Author: Zhao guanzhe 07. * Completion Date: April 8, March 15, 2013. * version: v1.0 09. * input Description: 10. * Problem description: 11. */# include <iostream> using namespace std; class Time {public: void set_time (); void show_time (); inline int add_a_sec (); // Add 1 second inline int add_a_minute (); // Add 1 minute inline int add_an_hour (); // Add 1 hour int add_seconds (); // Add n seconds Minutes int add_minutes (); // Add n minutes int add_hours (); // Add n hours private: bool is_time (int, int, int); int hour; int minute; int sec;}; void Time: set_time () {char c1, c2; cout <"Enter the Time (Format: hh: mm: ss)"; while (1) {cin> hour> c1> minute> c2> sec; if (c1! = ':' | C2! = ':') The cout <"format is incorrect. Enter" <endl; else if (! Is_time (hour, minute, sec) cout <"invalid Time. Enter" <endl; else break ;}} void Time: show_time () {cout
Running result: