Design a time class that contains static data members and member functions. A static data member is a common data for all objects in a class, in the following design, whether the clock is to be 12-hour or 24-hour, or if the number that is less than two digits is preceded by 0, is a "global" setting that is appropriate as a static data member in the class.
/** Copyright (c) 2015, Yantai University School of Computer * All right reserved.* Shao * file: demo.cpp* finish: April 08, 2015 * version number: v1.0*/#include <iostream > #include <cmath>using namespace Std;class time{public:time (int=0,int=0,int=0); void Show_time (); According to Is_24 and FROM0, the output is suitable for form -20:23:5/8:23:5 pm/08:23:05 pm void add_seconds (int); Added n seconds void add_minutes (int); Added n minutes void add_hours (int); Added n-hour static void Change24 (); Change static member is_24, convert static void Changefrom0 () between 12 and 24 o'clock; Change static member From0, toggle whether leading 0private:static bool is_24; When True, the 24-hour system, such as 20:23:5, is flase,12-hour, and is displayed as 8:23:5 pm static bool from0; When True, the leading 0,8:23:5 is displayed as 08:23:05 int hour; int minute; int sec;}; Time::time (int h,int m,int s): Hour (h), Minute (m), SEC (s) {};bool time::is_24=true;bool time::from0=true;void time::show _time () {int h= (is_24)? hour:hour%12; if (h<10&&from0) cout<< ' 0 '; cout<Operation Result:
@ Mayuko
Week five Project 4-static member application