实例介绍
【实例简介】
【实例截图】
【核心代码】
#include<stdio.h>
#include<stdlib.h>
void printvouchers()
{
int y;
printf("是否需要打印凭证:\n1、是\n2、否\n");
scanf("%d", &y);
if (y == 1)printf("已打印凭证\n");
}
void judge(int passport, int *PASSPORT)
{
int i;
for (i=1;passport != *PASSPORT;i )
{
if (i <= 3) { printf("重新输入"); scanf("%6d", &passport); }
else {
printf("输入密码错误超过三次,24小时之内不能进行任何操作"); exit(0);
}
}
}
void PASSPORTRESET(int *PASSPORT)
{
printf("请输入原密码");
int passport, newpassport1, newpassport2;
scanf("%6d", &passport);
judge(passport, PASSPORT);
loop : printf("请输入新密码");
scanf("%6d", &newpassport1);
printf("请再次输入新密码");
scanf("%6d", &newpassport2);
if (newpassport1 == newpassport2)
{
printf("修改成功");
*PASSPORT = newpassport1;
}
else goto loop;
}
void Balancecheck(double *Balance)
{
printf("%lf\n", *Balance);
}
#include<stdlib.h>
void printvouchers()
{
int y;
printf("是否需要打印凭证:\n1、是\n2、否\n");
scanf("%d", &y);
if (y == 1)printf("已打印凭证\n");
}
void judge(int passport, int *PASSPORT)
{
int i;
for (i=1;passport != *PASSPORT;i )
{
if (i <= 3) { printf("重新输入"); scanf("%6d", &passport); }
else {
printf("输入密码错误超过三次,24小时之内不能进行任何操作"); exit(0);
}
}
}
void PASSPORTRESET(int *PASSPORT)
{
printf("请输入原密码");
int passport, newpassport1, newpassport2;
scanf("%6d", &passport);
judge(passport, PASSPORT);
loop : printf("请输入新密码");
scanf("%6d", &newpassport1);
printf("请再次输入新密码");
scanf("%6d", &newpassport2);
if (newpassport1 == newpassport2)
{
printf("修改成功");
*PASSPORT = newpassport1;
}
else goto loop;
}
void Balancecheck(double *Balance)
{
printf("%lf\n", *Balance);
}
void deposit(double *Balance,double b)
{
double input1;
printf("请塞入纸币");
scanf("%lf", &input1);
if (input1 <= 10000)
{
*Balance =b input1;
printvouchers();
}
else printf("您的现金过多,已退回\n");
}
void withdraw(double *Balance, double b)
{
double input2;
for (;;)
{
printf("请输入取款金额");
scanf("%lf", &input2);
if (input2 <= 5000&&input2>=100)
{
if (input2 <= *Balance)
{
printf("取款成功");
*Balance = b - input2;
printvouchers();
break;
}
else { printf("您的余额不足\n"); break; }
}
if (input2 < 100) { printf("取款需大于一百\n"); continue; }
if (input2 > 5000) { printf("取款数过多\n"); continue; }
}
}
void enterpassport(int *PASSPORT)
{
int passport;
printf("请输入密码");
scanf("%d", &passport);
judge(passport,PASSPORT);
}
void transfer(double *Balance,double b)
{
double input3;
long long t;
printf("请输入卡号");
scanf("%ld", &t);
printf("请输入转账金额");
scanf("%lf", &input3);
if (input3 <= 50000)
{
printf("转账成功");
*Balance = b - input3;
printvouchers();
}
else printf("转账金额过多,请至柜台办理");
}
int main()
{
int x, *PASSPORT,a=123456;
PASSPORT = &a;
double *Balance,b=10000.00;
Balance = &b;
for(;;)
{
printf("请选择要办理的业务:\n1、修改密码\n2、查询余额\n3、存款\n4、取款\n5、转账\n6、退卡\n");
scanf("%d",&x);
switch (x)
{
case 1:PASSPORTRESET(PASSPORT); break;
case 2:Balancecheck(Balance); break;
case 3:enterpassport(PASSPORT); deposit(Balance, b); break;
case 4:enterpassport(PASSPORT); withdraw(Balance, b); break;
case 5:enterpassport(PASSPORT); transfer(Balance, b); break;
case 6:printf("您的银行卡已正常退出"); return 0;
}
system("pause");
system("cls");
{
double input1;
printf("请塞入纸币");
scanf("%lf", &input1);
if (input1 <= 10000)
{
*Balance =b input1;
printvouchers();
}
else printf("您的现金过多,已退回\n");
}
void withdraw(double *Balance, double b)
{
double input2;
for (;;)
{
printf("请输入取款金额");
scanf("%lf", &input2);
if (input2 <= 5000&&input2>=100)
{
if (input2 <= *Balance)
{
printf("取款成功");
*Balance = b - input2;
printvouchers();
break;
}
else { printf("您的余额不足\n"); break; }
}
if (input2 < 100) { printf("取款需大于一百\n"); continue; }
if (input2 > 5000) { printf("取款数过多\n"); continue; }
}
}
void enterpassport(int *PASSPORT)
{
int passport;
printf("请输入密码");
scanf("%d", &passport);
judge(passport,PASSPORT);
}
void transfer(double *Balance,double b)
{
double input3;
long long t;
printf("请输入卡号");
scanf("%ld", &t);
printf("请输入转账金额");
scanf("%lf", &input3);
if (input3 <= 50000)
{
printf("转账成功");
*Balance = b - input3;
printvouchers();
}
else printf("转账金额过多,请至柜台办理");
}
int main()
{
int x, *PASSPORT,a=123456;
PASSPORT = &a;
double *Balance,b=10000.00;
Balance = &b;
for(;;)
{
printf("请选择要办理的业务:\n1、修改密码\n2、查询余额\n3、存款\n4、取款\n5、转账\n6、退卡\n");
scanf("%d",&x);
switch (x)
{
case 1:PASSPORTRESET(PASSPORT); break;
case 2:Balancecheck(Balance); break;
case 3:enterpassport(PASSPORT); deposit(Balance, b); break;
case 4:enterpassport(PASSPORT); withdraw(Balance, b); break;
case 5:enterpassport(PASSPORT); transfer(Balance, b); break;
case 6:printf("您的银行卡已正常退出"); return 0;
}
system("pause");
system("cls");
}
}
}
好例子网口号:伸出你的我的手 — 分享!
相关软件
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论