ing from 0
k=0;
//Tage code is accurate
flag=1;
while((ch=getch()) && ch!=13 && k<6)
{
putchar('*');
code[k++]=ch;
}
//Code is accurate
for(j=0; j<6; j++)
{
if(password[j] != code[j])
{
// code is wrong!
flag=0;
}
}
if(flag)
{
printf("\nYou code is accurate!\n");
return 1;
}
else
{
if(i<2)
{
printf("\nYou enter wrong password! Pleas enter the password again!\n");
}
else
{
printf("\nYou input three wrong password three times,your account has been locked!\n");
}
}
}
return 0;
}
void Deposit_money(void)
{
float money;
printf("\nService is you choose to deposit money.");
printf("\nPlease input you want to deposit money:");
scanf("%f", &money);
sum_money+= money;
printf("\nThey have %f yuan on your account.\n", sum_money);
Star();
}
void Withdraw_money(void)
{
float money;
printf("\nService is you choose to withdraw money.");
printf("\nPlease input you want to withdraw money:");
scanf("%f", &money);
sum_money-=money;
printf("\nYou want take money is %f yuan\n", money);
printf("\nThey have %f yuan on your account.\n", sum_money);
Star();
}
void Transfer_money(void)
{
float money;
printf("\nService is you choose to transfer money.");
printf("\nPlease input you want to tansfer money:");
scanf("%f", &money);
sum_money-=money;
printf("\nYou want transfer money %f yuan", money);
printf("\nThey have %f yuan on your account.\n", sum_money);
Star();
}
void Count_rate(void)
{
int i;
int year;
float interest;
printf("\nService is you choose to count rate.");
printf("\nPlease input the number of year you want deposit:");
scanf("%d", &year);
for(i=1; i<=year; i++)
{
interest=sum_money*interest_rate;
sum_money+=interest;
printf("%2d year,you will have interest:%f yuan,you will have sum_money:%f yuan.\n", i, interest, sum_money);
}
Star();
} 局部图:
