📄 000111.txt
字号:
include<iostream>
using namespace std;
class date
{
int yy;
int mm;
int dd;
public:
void set(int a,int b,int c);
void print(char a,int b);
};
void date::set(int a,int b,int c)
{
yy=a;
mm=b;
dd=c;
}
void date::print(char a,int b)
{
if(b==1)
{
if(yy<10)
cout<<'0'<<yy<<a<<mm<<a<<dd;
else
cout<<yy<<a<<mm<<a<<dd;
}
else if(b==2)
{
if(yy<10)
cout<<mm<<a<<dd<<a<<'0'<<yy;
else
cout<<mm<<a<<dd<<a<<yy;
}
else if(b=3)
{
if(yy<10)
cout<<dd<<a<<mm<<a<<'0'<<yy<<endl;
else
cout<<dd<<a<<mm<<a<<yy<<endl;
}
else
cout<<"sorry there have none!!\n";
}
void main()
{
date p;
int i,j,k;
char a;
int b;
cout<<"please cin the data:\n";
cout<<"year(>0):"<<endl;
cin>>i;
cout<<"month(0-12):"<<endl;
cin>>j;
cout<<"data(0-31):"<<endl;
cin>>k;
if(i<0||j>12||j<0||k<0||k>31)
cout<<"the wrong cin!!\n";
else
{
p.set(i,j,k);
cout<<"cin the (、/、-等):\n";
cin>>a;
cout<<"中国 1"<<endl
<<"美国 2"<<endl
<<"欧洲 3"<<endl;
cout<<"please choose:\n";
cin>>b;
p.print(a,b);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -