000111.txt
来自「这个是我们数据结构第三个实验的源代码,在这里和大家一起分享」· 文本 代码 · 共 71 行
TXT
71 行
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 + =
减小字号Ctrl + -
显示快捷键?