<img src="https://img-blog.csdn.net/20150420165714438?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvem91amlhaHVpMTIz/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />#include <iostream>
using namespace std;
class Time
{public:
void set_time(void);
void show_time(void);
private:
int hour;
int minute;
int sec;
};
void Time::set_time(void)
{cin>>hour;
cin>>minute;
cin>>sec;
}
void Time::show_time(void)
{cout<<hour<<":"<<minute<<":"<<sec<<endl;}
Time t;
int main()
{ t.set_time();
t.show_time();
return 0;
}
第二章第3题
最新推荐文章于 2023-03-02 20:15:45 发布