资源描述:
《c语言课程设计--银行自动存取款机模拟》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、作者:周鸣需求分析:本程序设计的任务为银行自助存取款机,程序要求实现atm机的基本功能,如开户.查询.存款.取款.转账.容而生成操作日志。2.概要设计:数据类型:int,char,FILE.主程序流程:intmain()1:进入dl()函数。2:核对输入账户与密码。3.核对成功则进入dljm()函数。4.选择操作功能。5.完成操作,回到功能选择一栏。6.可选择退卡以结束所有操作。标准函数名称和自定义名称:Voiddl()Voiddljm()Voidcx()Voidck()Voidqk()Voidzz()开始程序开始程序3.主程序的流程及各函数之间
2、的流程关系。(用图来描述)进入dl函数输入账号输入密码进入dljm函数选择atm机功能输入“100”,退出函数进入zz函数进入tk函数进入ck函数进入qk函数进入cx函数15432#include#includeintx,k;voiddl();intdljm();voidcx();voidqk();voidzz();voidck();voidtk();FILE*fp;FILE*fg;structatm{charname[10];intaccount;shortpassword;floatmoney;}at[1
3、0]={{"AA",1,1,4000},{"BB",2,2,4000},{"CC",3,3,4000},{"DD",4,4,4000},{"EE",5,5,4000},{"GG",6,6,4000},{"HH",7,7,4000},{"II",8,8,4000},{"JJ",9,9,4000},{"kk",10,10,4000}};voidmain(){charfilename[]="zhouming.txt";charmode[]="w",b[]="AA114000BB224000CC334000DD444000EE554000GG664000
4、HH774000II884000JJ994000KK10104000";clrscr();if((fg=fopen("x.txt","a+"))==NULL){printf("cannotopenthefilezhouming!strikeanyexit");getch();exit(1);}dl();if((fp=fopen(filename,mode))!=NULL){fputs(b,fp);fclose(fp);}}voiddl(){intaccount,i,j;shortpassword;printf("pleaseenterthecar
5、dnumber:");fprintf(fg,"pleaseenterthecardnumber:");scanf("%d",&account);fprintf(fg,"%d",account);if(account>10)dl();for(k=0;k<=9;k++){if(account==at[k].account){x=k;fprintf(fp,"pleaseenterthecardnumber:%d");printf("pleaseenterpassword:");fprintf(fg,"pleaseenterpassword:
6、");scanf("%d",&password);fprintf(fg,"%d",password);for(i=1;i<4;i++){if(password==at[k].password){fprintf(fg,"pleaseenterthepassword:%d");printf("loginsuccessfully,pleaseselectoperation");fprintf(fg,"loginsuccessfully,pleaseselectoperation");dljm();break;}else{printf
7、("passwordinputerror");printf("enterpasswordagain!");fprintf(fg,"passwordinputerror");fprintf(fg,"enterpasswordagain!");scanf("%d",&password);fprintf(fg,"%d",password);while(i==3){system("cls");main();}}}}}}intdljm(){intz;printf("querybalance-----------1");printf("w
8、ithdrawals-----------2");printf("deposit----------3");printf("tr