设为首页 加入收藏

TOP

问题一百三十五:银行ATM (一)
2014-11-23 22:13:07 来源: 作者: 【 】 浏览:0
Tags:问题 一百三十五 银行 ATM

[plain] /**************************************************************
****Auther:liuyongshui
*****About:This is the BANK ATM applicantion
******Date:20130511
**************************************************************/

#include
#include
#include

#define interst_rate 0.035

float sum_money=654321.0;
//annual interest
float interest_rate=0.035;

void Star(void);
void Choice(void);
int Check_password(void);
void Deposit_money(viod);
void Withdraw_money(void);
void Transfer_money(void);
void Count_rate(void);

int main()
{
int num;
int mark;
int sign;

sign=1;
Star();
printf("\t\tWELCOME TO LEDUODUO BANK\t\t\t\t\n");

mark=Check_password();
if(mark)
{
printf("LOGIN SUCCEDFUL!\n");
}
else
{
printf("SORRY,LOGIN FILED!\n");
sign=0;
}

while(1)
{
if(sign==0)
{
printf("\nService is you choose to quit!\n");
break;
}

Choice();
printf("\nplease select a service NUMBER you want:");
scanf("%d", &num);
switch(num)
{
case 1: Deposit_money();
break;
case 2: Withdraw_money();
break;
case 3: Transfer_money();
break;
case 4: Count_rate();
break;
case 0: sign=0;
break;
}
}

printf("Thank your for you use!\n");
Star();
return 0;
}

// Function define

void Star(void)
{
int i;

for(i=0; i<60; i++)
{
printf("*");
}

printf("\n");
}

void Choice(void)
{
printf("\nplease select a service NUMBER you want.\n");
printf("\n\t\t 1:deposit money\n\t\t 2:withdraw money\n\t\t 3:transfer money\n\t\t 4:count money\n\t\t 0:quit\n\n");
}

int Check_password(void)
{
int i;
int j;
int k;
int flag;
char ch;
char code[10]={'\0'};
char password[10]={"123456"};

// You can input password three times
for(i=0; i<3; i++)
{
printf("Please enter the 6 digit code:");
//Make code[k] every time starting 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("\nSe

首页 上一页 1 2 3 下一页 尾页 1/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇问题一百三十二:自然数对 下一篇问题一百三十三:不容易系列之二

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: