《电气实训报告 ATM》由会员分享,可在线阅读,更多相关《电气实训报告 ATM(7页珍藏版)》请在金锄头文库上搜索。
1、流程图:开始选择 语言功能存款取款查询信息结束功能存款取款查询信息E中/*设定账号:12345678 密码:123456*/ #include #include int qukuan1()/取款函数 system(“cls“); float c;while(printf(“输入 0 退出。n 请输入整百数!n 请输入取款金额:“)/循环输入,多次操 作 scanf(“%f“,if(int)c%100=0break;default :printf(“欢迎下次使用!n“); else printf(“输入错误!n“); return 0; int cunkuan1()/存款函数 system(“c
2、ls“);/清屏int d; printf(“输入 0 退出。n 请将存款放入:n“); printf(“欢迎下次使用n!“); scanf(“%d“, switch(d) case 0:exit(0);break; default :; return 0; int xinxi1()/信息函数 system(“cls“); int e;FILE *fp; char ch;fp=fopen(“xinxi.txt“,“r“);/文件调用 if(fp=NULL) printf(“errorn“); else while(ch=fgetc(fp)!=EOF) putchar(ch); fclose(f
3、p);printf(“n 欢迎下次使用!n“);scanf(“%d“, switch(e) case 0:exit(0);break; default :; return 0; int chinese()/中文选择函数 system(“cls“); int zhanghao,mima,a,i,j; i=1; printf(“请输入账号:“); while(i=100) switch(int)f) case 0:exit(0);break;default :printf(“Welcome to the next using!n“); else printf(“Input errors!n“);
4、return 0; int cunkuan2() system(“cls“);int g;printf(“Enter 0 to exitn“); printf(“Please deposit into the ATM:n“); printf(“Welcome to the next using!n“);scanf(“%d“, switch(g) case 0:exit(0);break;default :; return 0; int xinxi2() system(“cls“); int h; printf(“Enter 0 to exitn“);FILE *fp; char ch;fp=f
5、open(“xinxi.txt“,“r“); if(fp=NULL) printf(“errorn“); else while(ch=fgetc(fp)!=EOF) putchar(ch); fclose(fp); printf(“nWelcome to the next using!n“);scanf(“%d“, switch(h) case 0:exit(0);break;default :; return 0; int english() system(“cls“); int zhanghao,mima,b,k,l; printf(“Please enter the account:“)
6、; while(k4) +k; scanf(“%d“, if(zhanghao=12345678) printf(“Please enter your password:“); while(l4) +l; scanf(“%d“, if(mima=123456) system(“cls“); printf(“The machine features is:nWithdrawals-1nDeposit- 2nAccount Information-3nEexit-0nPlease select:“);scanf(“%d“,switch(b) case 1:qukuan2();break;case
7、2:cunkuan2();break;case 3:xinxi2();break;case 0:exit(0); elseprintf(“Password error!n“); switch(l) case 4:exit(0);break;default :printf(“Please re-enter password:“);break; else printf(“Account error!n“);switch(k) case 4:exit(0);break; default :printf(“Please re-enter account:“);break; return 0;main()/主函数 int language; printf(“ #欢迎使用中国建设银行自动存取款机#n“); printf(“#Welcome to China Construction Bank Automatic Teller Machine#n“); printf(“中文-1nEnglish-2n 退出exit-0n 请选择:“); while(scanf(“%d“,break;case 2:english();break;case 0:exit(0);