C语言ATM机代码,简单版。
2014-08-23 16:41
176 查看
#include <stdio.h>
void main()
{
int i,j;
int code=0,flag=0;
int choice1=0,choice2=0,choice3=0;
int RMB=100000,WB=100000;
int cash1=0,cash2=0;
char instruct='n';
printf("************************************************************\n");
printf("* *\n");
printf("* *\n");
printf("* 欢迎使用 怪精 ATM取款机 *\n");
printf("* *\n");
printf("* 监制: rain version number:1.0.1 *\n");
printf("* *\n");
printf("* *\n");
printf("************************************************************\n");
printf("请键入您的密码:\n"); /*密码为9527*/
for(i=0;i<3;i++)
{
scanf("%d",&code);
system("cls");
if(code==9527)
{
break;
}
if(code!=9527)
{
printf("密码有误!请重新输入:\n");
flag+=1;
}
}
if(flag==3)
{
printf("密码错误超限,请回去面壁思过,再见!");
return;
}
while(instruct=='N'|| instruct=='n' )
{
if(code==9527)
{
printf("请选择您所需服务!\n");
printf("1.查询余额 2.取款 3.退出");
scanf("%d",&choice1);
system("cls");
switch(choice1)
{
case 1:printf("1.人民币 2.外汇");
scanf("%d",&choice2);
system("cls");
switch(choice2)
{
case 1:printf("您的人民币账户余额:¥%d\n",RMB);
break;
case 2:printf("您的外币账户余额:$%d\n",WB);
break;
}
break;
case 2:printf("1.人民币 2.外币");
scanf("%d",&choice3);
system("cls");
switch(choice3)
{
case 1:printf("请输入取款金额:\n");
scanf("%d",&cash1);
RMB=RMB-cash1;
printf("您的账户余额为:¥%d\n",RMB);
break;
case 2:printf("请输入取款金额:\n");
scanf("%d",&cash2);
WB=WB-cash2;
printf("您的账户余额为:$%d\n",WB);
break;
}
break;
case 3:
break;
}
printf("是否退出程序<y表示是,n表示否>:");
scanf("%s",&instruct);
}
}
}
void main()
{
int i,j;
int code=0,flag=0;
int choice1=0,choice2=0,choice3=0;
int RMB=100000,WB=100000;
int cash1=0,cash2=0;
char instruct='n';
printf("************************************************************\n");
printf("* *\n");
printf("* *\n");
printf("* 欢迎使用 怪精 ATM取款机 *\n");
printf("* *\n");
printf("* 监制: rain version number:1.0.1 *\n");
printf("* *\n");
printf("* *\n");
printf("************************************************************\n");
printf("请键入您的密码:\n"); /*密码为9527*/
for(i=0;i<3;i++)
{
scanf("%d",&code);
system("cls");
if(code==9527)
{
break;
}
if(code!=9527)
{
printf("密码有误!请重新输入:\n");
flag+=1;
}
}
if(flag==3)
{
printf("密码错误超限,请回去面壁思过,再见!");
return;
}
while(instruct=='N'|| instruct=='n' )
{
if(code==9527)
{
printf("请选择您所需服务!\n");
printf("1.查询余额 2.取款 3.退出");
scanf("%d",&choice1);
system("cls");
switch(choice1)
{
case 1:printf("1.人民币 2.外汇");
scanf("%d",&choice2);
system("cls");
switch(choice2)
{
case 1:printf("您的人民币账户余额:¥%d\n",RMB);
break;
case 2:printf("您的外币账户余额:$%d\n",WB);
break;
}
break;
case 2:printf("1.人民币 2.外币");
scanf("%d",&choice3);
system("cls");
switch(choice3)
{
case 1:printf("请输入取款金额:\n");
scanf("%d",&cash1);
RMB=RMB-cash1;
printf("您的账户余额为:¥%d\n",RMB);
break;
case 2:printf("请输入取款金额:\n");
scanf("%d",&cash2);
WB=WB-cash2;
printf("您的账户余额为:$%d\n",WB);
break;
}
break;
case 3:
break;
}
printf("是否退出程序<y表示是,n表示否>:");
scanf("%s",&instruct);
}
}
}
相关文章推荐
- C语言垃圾代码清除工具(含源码)
- GNU的C++代码书写规范,C语言之父Dennis Ritchie亲自修订
- C语言中实现跳转到任意行代码执行
- 这里是MYSQL操作的C语言代码,我贴几个,你们看吧333
- 如何用C语言编写幂运算的代码?救急!!!
- 这里是MYSQL操作的C语言代码,我贴几个,你们看吧444444
- C语言的memset函数代码(47)
- 我最近在做MYSQL的C语言代码的连接,网上代码PHP和 MYSQL的太多了,我现在贴个C语言的,喜欢C的,来看下吧,
- 这里是MYSQL操作的C语言代码,我贴几个,你们看吧2222222
- C语言代码编写技巧(1)
- 如何优化C语言代码(程序员必读)
- 如何优化C语言代码
- 如何优化C语言代码
- 水滴石穿C语言之代码检查工具
- 水滴石穿C语言之代码检查工具
- DataStructure---LinkList 链表C语言实现代码
- 如何优化C语言代码(程序员必读)
- 我的一个 C语言代码
- 数值分析多种算法C语言代码-推荐
- 优化C语言代码常用的几招