欢迎来到天天文库
浏览记录
ID:55588553
大小:32.50 KB
页数:8页
时间:2020-05-19
《校园卡管理系统-C语言.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、#include#include#include#include#includestructcard1/*校园卡的数据类型*/{intcardnum;charstudentname[10];intstudentclass;intmoney;charpassword[7];}card[100];voidman_system();/*完*/voidstu_system();/*完*/voiddelcard();/*完*/voidaddcard();/*完*/voidadd
2、money();/*完*/voidcheckmoney();/*完*//*guashi();*//*jiegua();*/voidchangepassword();/*完*/intpassword1();/*半完*/intpassword2();/**/inti1=0;voidmain()/*主函数*/{intchoice;do{printf("------------------------------------------");printf("
3、
4、");printf("
5、Welcometoschoolcardsystem!
6、");prin
7、tf("------------------------------------------");printf("Pleasechoosesystem:");printf("1.managersystem");printf("2.studentsystem");printf("Pleaseint1-2:");scanf("%d",&choice);switch(choice){case1:man_system();break;case2:stu_system();break;default:printf("Nothischoice!");bre
8、ak;}}while(1);getch();return;}voidman_system()/*管理端管理系统*/{intchoice;intifright;ifright=password1();if(ifright==1){while(1){printf("-----welcometomanagersystem-----");printf("1:Addnewcard2:Delete3:Addmoney4:Checkmoney0:Back");printf("Pleaseint0-4:");scanf("%d",&choice);
9、switch(choice){case1:addcard();break;case2:delcard();break;case3:addmoney();break;case4:checkmoney();break;case0:return;break;default:printf("Nothischoice!");break;}}}getch();return;}voidstu_system()/*学生端管理系统*/{intchoice;while(1){printf("-----Welcometostudentsystem-----");prin
10、tf("1:Guashi2:Jiegua3:Changepassword4:Checkmoney0:Back");printf("Pleaseint0-4:");scanf("%d",&choice);switch(choice){/*case1:guashi();break;case2:jiegua();break;*/case3:changepassword();break;case4:checkmoney();break;case0:return;break;default:printf("Can'tcametruenow!");
11、break;}}getch();return;}voiddelcard()/*删除旧卡*/{FILE*fp,*fp2;inti;intcardnum;charchoice;fp=fopen("card.txt","r");fp2=fopen("bookl.txt","w");printf("Pleaseenterthenumberyouwanttodelete:");scanf("%d",&cardnum);for(i=0;fread(&card[i],sizeof(structcard1),1,fp)!=0;i++){if(card[i].cardnum
12、!=cardnum){fwrite(&
此文档下载收益归作者所有