3.24

来源:互联网 发布:dia frampton知乎 编辑:程序博客网 时间:2024/06/05 22:55
 #include<iostream>
using namespace std;
class Date
{
public:
Date(int year,int month,int day)
{
y=year;
m=month;
d=day; 
}
 
void getyear();
void getmonth();
void getday();
void display();
private:
int y,m,d;
};
void Date::display()
{
cout<<y<<"年"<<m<<"月"<<d<<"日"<<endl;

int main()
{
Date z(2014,4,1);
cout<<"z的相关信息是:"<<endl;
z.display();
return 0;
}
0 0
原创粉丝点击