标签:des blog io os 数据 2014 div sp log
9 10 11
9:10:11
#include <iostream>
using namespace std;
//声明类类型
class time
{
//定义私有部分
private:
int h;
int m;
int s;
//定义公有部分
public:
void settime()//赋值成员函数
{
cin >>h>>m>>s;
}
void showtime()//输出成员函数
{
cout <<h<<":"<<m<<":"<<s<< endl;
}
};//不要忘了这个分号
//主函数
int main()
{
class time t;
t.settime();
t.showtime();
return 0;
}
标签:des blog io os 数据 2014 div sp log
原文地址:http://blog.csdn.net/u013634961/article/details/39185905