求指错加编码
#include <stdio.h>#include <stdlib.h>
struct
{
char name;
int money;
int initialPassword[];
} customer;
data()
{
customer.name="张三";
customer.money=10000;
customer.initialPassword;
}
int inquisy()
{
data();
int i;
printf("\t\t\t 姓名:%s\n",customer.name);
printf("\t\t\t 余额: %d\n",customer.money);
printf("按0返回上一层\n");
while(i!=0)
{
scanf("%d",&i);
printf("请重新输入\n");
}
function();
return data;
}
int depositMoney()
{
data();
int add;
int i;
printf("请输入需要充值的面额\n");
scanf("%d",&add);
while((add%100)!=0)
{
printf("请输入整百的面额\n");
scanf("%d",&add);
}
customer.money=customer.money+add/4;
printf("您的余额为:%d\n",customer.money);
printf("按0返回上一层\n");
while(i!=0)
{
scanf("%d",&i);
printf("请重新输入");
}
function();
return customer.money;
}
int withdrawMoney() {}
int transferAccounts() {}
void changePasswords()
{
/*inputPassword(number[6]);
int number0[6];
int i=0;
printf("\t\t\t\t请输入密码\n");
scanf("%d",&number0[6]);
//printf("初始密码000000\n");
/* while(number)
{
scanf("%d",&number[6]);
if(number[6]==000000)
{
printf("\n\n\n请输入新的密码");
break;
}
else
{
printf("密码错误,请重新输入\n");
}
}
if(number0[6]==number[6])
{
printf("输入错误,无可与旧密码相同\n");
changePasswords();
}
else
{
printf("新密码输入成功\n");
}
printf("按0放回上一程");
scanf("%d",&i);
if(i==0)
{
function();
}
else
printf("请重新输入");*/
}
void functionValue()
{
int i=0;
scanf("%d",&i);
if(i>0&&i<6)
{
switch(i)
{
case 1:
inquisy();
break;
case 2:
depositMoney();
break;
case 3:
withdrawMoney();
break;
case 4:
transferAccounts();
break;
case 5:
changePasswords();
break;
}
}
else
{
printf("请重新输入\n");
functionValue();
}
}
void function()
{
printf("\t\t\t 需要使用的功能:\n");
printf("\t\t1.查询");
printf("\t\t\t2.存款\n");
printf("\t\t3.取款");
printf("\t\t\t4.转账\n");
printf("\t\t5.更改密码\n");
functionValue();
}
void inputPassword()
{
int isHas=0;
int number[6];
int initialPassword[]= {0,0,0,0,0,0};
int i=0,j=0,s=0;
printf("初始密码000000\n");
printf("\t\t\t\t请输入密码\n");
for(i=0; i<6; i++)
{
scanf("%d",&number[i]);
}
for(j=0; j<6; j++)
{
if(number[j]==initialPassword[j])
{
isHas=1;
}
else
{
isHas=0;
printf("请重新输入\n");
inputPassword();
}
}
if(isHas==1)
function();
}
void mainMenu()
{
int isHas=0;
printf("\t\t\t\ 欢迎使用湖南农大存取款机\t\t\n\n\n");
printf("\t\t\t\t ------------\t\t\t\n");
printf("\t\t\t\t| 请插入卡 |\t\t\t\n");
printf("\t\t\t\t ------------\t\t\t\n");
system("pause");
inputPassword();
}
int main()
{
int password[]= {0,0,0,0,0,0};
mainMenu();
return 0;
}
存款过后 在查询依旧是1000,