#include<iostream>using namespace std;class clock{public:void settime(int newh=0,int newm=0,int news=0);void showtime();private:int hour,minute,second;};void clock::settime(int newh=0,int newm=0,int news=0){hour=newh;minute=newm;second=news;}inline void clock::showtime(){cout<<hour<<":"<<minute<<":"<<second<<endl;}int main(){clock m;cout<<"first time set and output"<<endl;m.settime();m.showtime();cout<<"second time set and output"<<endl;m.settime(8,32,41);m.showtime();return 0;}
2 回答
- 2 回答
- 0 关注
- 127 浏览
添加回答
举报
0/150
提交
取消