3.24
来源:互联网 发布:mysql登录指定数据库 编辑:程序博客网 时间:2024/05/18 01:24
#include <iostream>
using namespace std;
class Date
{
public :
Date(int y,int m,int d);
void getyear();
void getmonth();
void getday();
void setdate(int y,int m,int d);
void printDate();
Date()
{}
Date(const Date& p)
{
year=p.year;
month=p.month;
day=p.day;
}
private :
int year;
int month;
int day;
};
Date::Date(int y,int m,int d)
{
year=y;
month=m;
day=d;
}
void Date::getyear()
{
cout<<"请输入年:";
cin>>year;
}
void Date::getmonth()
{
cout<<"请输入月:";
cin>>month;
}
void Date::getday()
{
cout<<"请输入日:";
cin>>day;
}
void Date::setdate(int y,int m,int d)
{
year=y;
month=m;
day=d;
}
void Date::printDate()
{
cout<<"日期为:"<<year<<"/"<<month<<"/"<<day<<endl;
}
int main()
{
Date d1(2010,6,8);
d1.printDate();
Date d2;
d2.getyear();
d2.getmonth();
d2.getday();
d2.printDate();
Date d3(d1);
d3.printDate();
system("pause");
return 0;
}
0 0
- 3.24
- 3.24
- 3.24
- 3.24
- 3.24
- 3.24
- 3.24
- 【3.24】
- 3.24
- 3.24
- 3.24
- 3.24
- 3.24
- 3.24
- 3.24
- 3.24
- 3.24
- 3.24
- 数据库调优教程(九) 添加了索引但不被使用的几种常见可能
- KNIMI数据挖掘建模与分析系列_001_利用KNIMI做演员关系网络分析
- 2015-4-12
- js 解析json
- bootstrap+jquery+mustache+springmvc+idworker整合demo代码
- 3.24
- 2015-4-12
- Android开发之WebService介绍
- awk记录
- Android平台调用WebService详解
- GitHub Top 100 Objective-C 项目简介
- Could not update ICEauthority file /home/user/.ICEauthority
- explicit关键字
- linux下64位汇编的系统调用(4)