时钟类

来源:互联网 发布:阿里云 dnspod 编辑:程序博客网 时间:2024/05/21 14:08
#include<iostream>
using namespace std;
class colck
{
public:
void  settime(int newh = 0,int  newm = 0,int news=0);
void  showtime();
private:
int hour, minute, second;
};
void  colck::settime(int newh , int  newm , int news)
{
hour = newh;
minute = newm;
second = news;
}
void  colck::showtime()
{
cout <<hour<<'-'<<minute<<'-'<<second<< endl;
}
int main()
{
colck mycolock;
mycolock.settime();
mycolock.showtime();
cout <<".............." << endl;
mycolock.settime(8, 30, 2);
mycolock.showtime();
system("pause");
return  0;
}
0 0
原创粉丝点击