请帮我解释一下这个c语言程序问题,谢谢
#include<iostream.h>doublenumber=100000;doublecard[10][20];voidOcard(){inti=0;while(i...
#include<iostream.h>
double number=100000;
double card[10][20];
void Ocard()
{
int i=0;
while(i<10)
{
if(card[i][19]==1)
i++;
else
{
card[i][0]=number+i;
card[i][19]=1;
cout<<"你办理的卡号为:"<<card[i][0]<<endl;
cout<<"请设置密码:";
cin>>card[i][18];
cout<<"密码设置成功,请妥善保管密码!"<<endl;
break;
}
}
if(i==10)
cout<<"对不起,储蓄卡已经办完!";
}
void Dcard()
{
cout<<"请输入你要退卡的卡号:";
double num;
cin>>num;
int i=0;
while(i<10)
{
if(card[i][0]==num)
{
card[i][19]=0;
cout<<"退卡操作成功";
break;
}
else i++;
}
if(i==10)
cout<<"对不起,这个卡号不存在";
}
void Icard()
{
cout<<"输入您要存款的账号:";
double num;
cin>>num;
int i=0;
while(i<10)
{
if(card[i][0]==num)
{
int k=card[i][2];
if(k<15)
{
cout<<"输入你要存款的金额:";
cin>>card[i][k+3];
card[i][1]+=card[i][k+3];
card[i][2]++;
cout<<"存款操作成功!"<<endl;
}
else
{
cout<<"对不起,你今天不能再进行交易";
break;
}
break;
}
else
i++;
}
if(i==10)
cout<<"对不起,这个卡号不存在";
}
void Qcard()
{
cout<<"输入你要取款的卡号:";
double num;
cin>>num;
cout<<"请输入密码:";
double code;
cin>>code;
int i=0;
while(i<10)
{
if(card[i][0]==num)
{
if(code==card[i][18])
{
int k=card[i][2];
if(k<15)
{
cout<<"输入你要取款的金额:";
double money;
cin>>money;
if(money<=card[i][2])
{
money=-money;
card[i][k+3]=money;
card[i][1]+=money;
card[i][2]++;
cout<<"取款操作成功!"<<endl;
}
else
{
cout<<"你卡上的余额不足!"<<endl;
cout<<"余额:"<<card[i][1]<<endl;
}
}
}
else
{
cout<<"密码不对!"<<endl;
break;
}
break;
}
else
i++;
}
if(i==10)
cout<<"对不起,这个考号不存在"<<endl;
}
void Check()
{
double num;
double code;
cout<<"请输入你要查询的账号:";
cin>>num;
cout<<"请输入密码:";
cin>>code;
int i=0;
while(i<10)
{
if(card[i][0]==num)
{
if(card[i][18]==code)
{
cout<<"余额:"<<card[i][1]<<" 今日交易次数:"<<card[i][2]<<endl;
int k=3;
while(k<card[i][2]+3)
{
cout<<"第"<<k-2<<"次:"<<card[i][k]<<" "<<endl;
k++;
}
break;
}
else
{
cout<<"密码不对!"<<endl;
break;
}
}
else
i++;
}
if(i==10)
cout<<"你要查询的账号不存在!"<<endl;
}
void main()
{
int a;
char b='Y';
while(b=='Y'||b=='y')
{
cout<<"请选择服务类型: 1:开户; 2:消户; 3:取款; 4:存款;5:查询。"<<endl;
cin>>a;
switch(a)
{
case 1: Ocard();
break;
case 2: Dcard();
break;
case 3: Qcard();
break;
case 4: Icard();
break;
case 5: Check();
break;
}
cout<<"是否还需要其它服务:Y/N: ";
cin>>b;
}
} 展开
double number=100000;
double card[10][20];
void Ocard()
{
int i=0;
while(i<10)
{
if(card[i][19]==1)
i++;
else
{
card[i][0]=number+i;
card[i][19]=1;
cout<<"你办理的卡号为:"<<card[i][0]<<endl;
cout<<"请设置密码:";
cin>>card[i][18];
cout<<"密码设置成功,请妥善保管密码!"<<endl;
break;
}
}
if(i==10)
cout<<"对不起,储蓄卡已经办完!";
}
void Dcard()
{
cout<<"请输入你要退卡的卡号:";
double num;
cin>>num;
int i=0;
while(i<10)
{
if(card[i][0]==num)
{
card[i][19]=0;
cout<<"退卡操作成功";
break;
}
else i++;
}
if(i==10)
cout<<"对不起,这个卡号不存在";
}
void Icard()
{
cout<<"输入您要存款的账号:";
double num;
cin>>num;
int i=0;
while(i<10)
{
if(card[i][0]==num)
{
int k=card[i][2];
if(k<15)
{
cout<<"输入你要存款的金额:";
cin>>card[i][k+3];
card[i][1]+=card[i][k+3];
card[i][2]++;
cout<<"存款操作成功!"<<endl;
}
else
{
cout<<"对不起,你今天不能再进行交易";
break;
}
break;
}
else
i++;
}
if(i==10)
cout<<"对不起,这个卡号不存在";
}
void Qcard()
{
cout<<"输入你要取款的卡号:";
double num;
cin>>num;
cout<<"请输入密码:";
double code;
cin>>code;
int i=0;
while(i<10)
{
if(card[i][0]==num)
{
if(code==card[i][18])
{
int k=card[i][2];
if(k<15)
{
cout<<"输入你要取款的金额:";
double money;
cin>>money;
if(money<=card[i][2])
{
money=-money;
card[i][k+3]=money;
card[i][1]+=money;
card[i][2]++;
cout<<"取款操作成功!"<<endl;
}
else
{
cout<<"你卡上的余额不足!"<<endl;
cout<<"余额:"<<card[i][1]<<endl;
}
}
}
else
{
cout<<"密码不对!"<<endl;
break;
}
break;
}
else
i++;
}
if(i==10)
cout<<"对不起,这个考号不存在"<<endl;
}
void Check()
{
double num;
double code;
cout<<"请输入你要查询的账号:";
cin>>num;
cout<<"请输入密码:";
cin>>code;
int i=0;
while(i<10)
{
if(card[i][0]==num)
{
if(card[i][18]==code)
{
cout<<"余额:"<<card[i][1]<<" 今日交易次数:"<<card[i][2]<<endl;
int k=3;
while(k<card[i][2]+3)
{
cout<<"第"<<k-2<<"次:"<<card[i][k]<<" "<<endl;
k++;
}
break;
}
else
{
cout<<"密码不对!"<<endl;
break;
}
}
else
i++;
}
if(i==10)
cout<<"你要查询的账号不存在!"<<endl;
}
void main()
{
int a;
char b='Y';
while(b=='Y'||b=='y')
{
cout<<"请选择服务类型: 1:开户; 2:消户; 3:取款; 4:存款;5:查询。"<<endl;
cin>>a;
switch(a)
{
case 1: Ocard();
break;
case 2: Dcard();
break;
case 3: Qcard();
break;
case 4: Icard();
break;
case 5: Check();
break;
}
cout<<"是否还需要其它服务:Y/N: ";
cin>>b;
}
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询