习题八
Xt8-1 #include
{public: //成员改为公用的 int hour; int minute; int sec; }; Time t;
void set_time(void) //在main函数之前定义 {
cin>>t.hour; cin>>t.minute; cin>>t.sec; }
void show_time(void) //在main函数之前定义 {
cout< } int main() {set_time(); show_time(); system(\ } Xt8-2 #include void set_time(void) {cin>>hour; cin>>minute; cin>>sec; } void show_time(void) {cout< private: int hour; int minute; int sec; }; Time t; int main() { t.set_time(); t.show_time(); system(\ } Xt8-3 #include void set_time(void); void show_time(void); private: int hour; int minute;