ImageVerifierCode 换一换
格式:DOCX , 页数:27 ,大小:19.85KB ,
资源ID:8040165      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/8040165.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(课程设计c语言版银行取款机系统.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

课程设计c语言版银行取款机系统.docx

1、课程设计c语言版银行取款机系统 课程设计C语言版银行取款机系统#include #include#include#include #define bool int#define true 1#define LEN sizeof(struct person)struct per /*定义全局结构体变量*/ char name20; char ID20; int money; char mima6; struct per *next;typedef struct person struct per kehu ; struct person *next; L; void chaxun(struct

2、per *head); /*函数声明*/void kaihu(struct per *head);void denglu(struct per *head);void display(struct per *head);void caidan(struct per *head);void qukuan(struct per *head);void xgmm(struct per *head);void cunkuan(struct per *head);void zhuangzhang(struct per *head);void tuichu();void menu();void out(s

3、truct person *r);void del(struct person *r);void sort(struct person *r);void insert(struct person *r); void search1(struct person *r);void search2(struct person *r);void search3(struct person *r);void createlist(struct person *r);/*主函数*/void main() char x; char choose; int flag=1; struct person *r=N

4、ULL; /*定义头指针*/ struct per *head=NULL; /*定义头指针*/ printf( *n); printf( * 欢迎使用ATM自动取款机系统 *n); printf( *nnnn); printf(-n); printf(| 1 开户 |n); printf(-n); printf(| 2 登录 |n); printf(-n); printf(| 3 前台客户信息查询中心|n); printf(-n); printf(| 请选择您的需求 |n); printf(-n); scanf(%s,&x); system(cls); switch(x) case 1:sys

5、tem(cls); kaihu(head); /*调用开户函数*/ break; case 2:system(cls); denglu(head); /*调用登陆函数*/ break; case 3:system(cls); menu(); /*调用后台菜单函数*/ break; while(flag) system(cls); menu(); /*调用后台菜单函数*/ choose=getchar(); switch(choose) case 1:createlist(&r); out(r); /*调用后台输出函数*/ system(pause); system(cls); break; c

6、ase 2:search1(r); /*调用后台卡号查询函数*/ system(pause); system(cls); break; case 3:search2(r); /*调用后台姓名查询函数*/ break; case 4:search3(r); /*调用后台余额查询函数*/ break; case 5:del(&r); /*调用后台删除用户函数函数*/ break; case 6:insert(&r); /*调用后台增加用户函数*/ break; case 7:sort(&r); /*调用后台排序函数函数*/ out(r); /*调用后台输出函数函数*/ break; case 8:

7、out(r); break; case 0:flag=0; printf(The end.n); break; /*开户函数*/void kaihu(struct per *head) head=NULL; FILE *fp; /*定义文件指针*/ per *p1=NULL,*p2=NULL; /*定义链表指针*/ p1=(per*)malloc(sizeof(per); /*开辟内存单元*/ printf(请输入您的姓名:n); scanf(%s,p1-name ); printf(请设置您的卡号:n); scanf(%s,p1-ID); printf(请设置您银行卡密码:n); scanf

8、(%s,p1-mima); p1-money=0; p1-next =NULL; if(NULL=head) /*为新增客户开辟内存单元*/ head=(per *)malloc(sizeof(per); head-next =p1; else /*为新增客户开辟内存单元*/ for(p2=head;p2-next!=NULL;p2=p2-next); p2-next=p1; if(fp=fopen(save.txt,ab+)=NULL) /*打开文件*/ printf(cannot open filen); return; if(fwrite(p1,sizeof(per),1,fp)!=1)

9、 /*将链表信息写入文件中*/ printf(file write errorn); fclose(fp); system(cls); printf(您的个人信息为n); display(head); /*调用链表输出函数*/*登陆函数*/ /void denglu(struct per *head) char d20; char mima20; int i,j; FILE *fp; /*定义文件指针*/ per *p,*q=NULL; if(fp=fopen(save.txt,rb+)=NULL) /*打开一个二进制文件,为读方式*/ printf(不能打开文件n); /*如不能打开,则结束

10、程序*/ p=(per*)malloc(sizeof(per); /*申请空间*/ head=p; while(!feof(fp) /*循环读数据直到文件尾结束*/ if(1!=fread(p,sizeof(per),1,fp) break; /*如果没读到数据,跳出循环*/ p-next=(per *)malloc(sizeof(per); /*为下一个结点申请空间*/ q=p; /*保存当前结点的指针,作为下一结点的前驱*/ p=p-next; /*指针后移,新读入数据链到当前表尾*/ q-next=NULL; /*最后一个结点的后继指针为空*/ fclose(fp); printf( *

11、n); printf( * 欢迎来到建设银行 *n); printf( *n); for(j=1;jnext) /*便利链表*/ if(strcmp(q-ID,d)!=0) /*核对账号*/ continue; else for(i=1;imima,mima)!=0) /*核对密码*/ printf(密码不正确,请重新输入密码n); system(pause); system(cls); continue; /*若密码不对,跳出循环*/ else system(cls); caidan(head); /*调用菜单函数*/ printf(nnn您输入密码三次错误,谢谢光临n); system(p

12、ause); system(cls); exit(0); printf(nnn您输入的卡号有误,请重试n); system(pause); system(cls); printf(您的卡号三次输入错误,谢谢使用); exit(0); /*输出函数*/void display(struct per *head) FILE *fp; per *p,*q=NULL; if(fp=fopen(save.txt,rb+)=NULL) /*打开一个二进制文件,为读方式*/ printf(不能打开文件n); /*如不能打开,则结束程序*/ p=(per*)malloc(sizeof(per); /*申请空间

13、*/ head=p; while(!feof(fp) /*循环读数据直到文件尾结束*/ if(1!=fread(p,sizeof(per),1,fp) break; /*如果没读到数据,跳出循环*/ p-next=(per *)malloc(sizeof(per); /*为下一个结点申请空间*/ q=p; /*保存当前结点的指针,作为下一结点的前驱*/ p=p-next; /*指针后移,新读入数据链到当前表尾*/ printf(姓名:%s n卡号:%s n余额:%4dn,q-name ,q-ID,q-money ); q-next=NULL; /*最后一个结点的后继指针为空*/ fclose(

14、fp); printf(n); printf(恭喜您开户成功,请登录n); system(pause); system(cls); denglu(head); /*银行菜单函数*/void caidan(struct per *head) head=NULL; int i; while(1) printf(请选择您需要的业务n); /*银行业务菜单*/ printf(*n); printf(* 1取款 * 2查询 *n); printf(*n); printf(* 3转账 * 4修改密码*n); printf(*n); printf(* 5存款 * 6退出 *n); printf(*nnn);

15、 scanf(%d,&i); if(i0) switch(i) case 1:qukuan(head); /*调用银行取款函数*/ system(pause); system(cls); break; case 2: system(cls); chaxun(head); /*调用银行查询函数*/ break; case 3:system(cls); zhuangzhang(head); /*调用银行转账函数*/ break; case 4:system(cls); xgmm(head); /*调用银行修改密码函数*/ break; case 5:system(cls); cunkuan(hea

16、d); /*调用银行存款函数*/ break; case 6:system(cls); tuichu(); /*调用银行退出函数*/ break; else printf(您的输入有误n); system(pause); system(cls); /*银行取款函数函数*/void qukuan(struct per *head) head=NULL;per *p; /*链表头指针*/int i;FILE *fp; /*文件头指针*/fp=fopen(save.txt,rb+); /*开辟空间*/p=(per*)malloc(sizeof(per);fread(p,sizeof(per),1,f

17、p); fclose(fp);system(cls); printf(*n);printf(* 1: 100元 * 2: 200元 *n);printf(*n);printf(* 3: 300元 * 4: 400元 *n);printf(*n);printf(* 5: 500元 * 6: 600元 *n);printf(*n); printf(请按要求选择您要取款的金额n); scanf(%d,&i); if(i6|ip-money ) printf(对不起,您的余额不足n); system(pause); system(cls); caidan(head); else p-money-=i;

18、 if(fp=fopen(save.txt,wb+)=NULL) /*打开文件*/ printf(cannot open filen); return; if(fwrite(p,sizeof(per),1,fp)!=1) /*将修改的信息重新写入文件*/ printf(file write errorn); printf(您已成功走取%d元n,i); p-next=NULL; fclose(fp); /*关闭文件*/*银行转账函数*/void zhuangzhang(struct per *head) head=NULL; /*链表头指针*/ FILE *fp; /*文件头指针*/char i

19、20,j20,k; per *p,*q=NULL; if(fp=fopen(save.txt,rb+)=NULL) /*打开一个二进制文件,为读方式*/ printf(不能打开文件n); /*如不能打开,则结束程序*/ p=(per*)malloc(sizeof(per); /*申请空间*/ head=p; while(!feof(fp) /*循环读数据直到文件尾结束*/ if(1!=fread(p,sizeof(per),1,fp) break; /*如果没读到数据,跳出循环*/ p-next=(per *)malloc(sizeof(per); /*为下一个结点申请空间*/ q=p; /*

20、保存当前结点的指针,作为下一结点的前驱*/ p=p-next; /*指针后移,新读入数据链到当前表尾*/ q-next=NULL; /*最后一个结点的后继指针为空*/ fclose(fp); printf(请输入转账号码n); scanf(%s,i); p=head;for(p;p!=NULL;p-next) if(strcmp(i,p-ID)!=0) printf(请重新输入n); zhuangzhang(head); else system(cls); printf(*n);printf(* 1: 100元 * 2: 200元 *n);printf(*n);printf(* 3: 300元

21、 * 4: 400元 *n);printf(*n);printf(* 5: 500元 * 6: 600元 *n);printf(*n); printf(请输入转账金额n); scanf(%d,&k); if(k6|kp-money ) printf(对不起,您的余额不足n); system(pause); system(cls); caidan(head); else printf(您已成功转账%d元n,k); p-money-=k; if(fp=fopen(save.txt,wb+)=NULL) /*打开文件*/ printf(cannot open filen); return; if(f

22、write(p,sizeof(per),1,fp)!=1) /*将修改的信息重新写入文件*/ printf(file write errorn); p-next=NULL; fclose(fp); p-next=NULL; system(pause); system(cls); /*银行查询函数*/void chaxun(struct per *head) head=NULL; /*链表头指针*/ per *p; /*文件头指针*/ FILE *fp; fp=fopen(save.txt,rb+); /*打开文件*/ p=(per*)malloc(sizeof(per); fread(p,si

23、zeof(per),1,fp); /*将信息从文件中读出来*/ fclose(fp); printf(您卡上原有余额为%d元nn,p-money); system(pause); system(cls); /*银行修改密码函数*/void xgmm(struct per *head) head=NULL; /*链表头指针*/ per *p; char mima20; FILE *fp; /*文件头指针*/ fp=fopen(save.txt,rb+); /*开辟内存*/ p=(per*)malloc(sizeof(per); /*打开文件*/ fread(p,sizeof(per),1,fp); /*将信

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1