标签:io ar amp on c har return user as
#include <stdio.h>
#include<string.h>
#include<stdlib.h>
void welcome()//输入账户
{
char user[10];
printf("请输入您的账户名:\n");
scanf("%s",user);
printf("welcome you!!\n%s\n",user);
}
int password() //输入密码
{
char pwd[10];
int j=3;//表示密码输入次数 表示循环控制变量
printf("请输入密码:\n");
while(j)
{
scanf("%s",pwd);
if(strcmp(pwd,"9527")==0){
return 1; //1表示密码输入正确
}
else
printf("密码输入错误,您还有%d次机会。\n",j-1);
j--;
}
if(j==0)
{
printf("3次密码输入错误,卡已经被锁定。\n");
return 0; //0表示密码输入错误
}
system("cls");
}
void xuanxiang()
{
int num,money=10000;
int qukuan=0,cunkuan=0;
printf("请选择你要进行的操作:\n1.查询\n2.取款\n3.存款\n4.退出\n");
scanf("%d",&num);
switch(num)
{
case 1:
printf("您的账户余额为:%d",money);
break;
case 2:
printf("您想取款的金额为:");
scanf ("%d",&qukuan);
if(qukuan<=money)
{
printf("您成功取款%d\n",qukuan);
money=money-qukuan;
}
else
printf("您的余额不足%\n");
printf("您的账户余额为:%d",money);
break;
case 3:
printf("您想存款的金额为:");
scanf ("%d",&cunkuan);
printf("您成功存款%d\n",cunkuan);
money=money+cunkuan;
printf("您的余额为%d\n",money);
case 4:
break;
system("cls");
}
}
void main()
{
int flag;
welcome();
flag=password();
printf("%d",flag);
if(flag==1)
{
xuanxiang();
}
}
标签:io ar amp on c har return user as
原文地址:http://www.cnblogs.com/august6-/p/3935806.html