e-4-1.txt
来自「最后声明」· 文本 代码 · 共 47 行
TXT
47 行
// E-4-1.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "4-1-1.h"
using namespace std;
void Date::set_date(){
cout<<"Please enter your birth year:\n";
cin>>year;
while(year<1850)
{cout<<"请输入正确年份";
cout<<"Year=";
cin>>year;
}
cout<<"Please enter your birth month:\n";
cin>>month;
while(month>13 || month<0)
{cout<<"Please enter the right month:\n";
cout<<"Month=";
cin>>month;
}
cout<<"Please enter your birth day:\n";
cin>>day;
while(day>31){
cout<<"请不要开玩笑";
cout<<"day=";
cin>>day;
}
}
void Date::disp_date(){
cout<<"You were born on the day of "<<year<<"年"<<month<<"月"<<day<<"日"<<endl;
}
void main()
{ Date b;
cout<<"Welcome!"<<endl;
b.set_date();
b.disp_date();
cout<<"Thank you for cooperation"<<endl;
system("pause");
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?