校园卡管理系统

上传人:公**** 文档编号:560290891 上传时间:2023-10-20 格式:DOCX 页数:8 大小:12.85KB
返回 下载 相关 举报
校园卡管理系统_第1页
第1页 / 共8页
校园卡管理系统_第2页
第2页 / 共8页
校园卡管理系统_第3页
第3页 / 共8页
校园卡管理系统_第4页
第4页 / 共8页
校园卡管理系统_第5页
第5页 / 共8页
点击查看更多>>
资源描述

《校园卡管理系统》由会员分享,可在线阅读,更多相关《校园卡管理系统(8页珍藏版)》请在金锄头文库上搜索。

1、#include #include #include #include #include struct card1 /*校园卡的数据类型*/ int cardnum;char studentname10; int studentclass; int money;char password7; card100;void man_system();/* 完*/ void stu_system();/* 芫*/ void delcard();/* 完*/ void addcard();/* 完*/ void addmoney();/* 完*/ void checkmoney();/* 完 */ /*

2、guashi();*/ /*jiegua();*/ void changepassword();/* 完*/ int password1();/* 半完 */ int password2();/*/ int i1=0;void main()/* 主函数*/int choice;doprintf(n);|n);|nn);printf(|printf(|Welcome to schoolcard system!printf(n);printf(Please choose system:n); printf(1.manager systemn); printf(2.student systemn);

3、 printf(Please int 1-2:); scanf(%d,&choice); switch(choice)case 1:man_system();break;case 2:stu_system();break;default:printf(No this choice!); break;while(1);getch();return;void man_system()/*管理端管理系统*/int choice;int ifright;ifright=password1();if(ifright=1)while(1)printf(nwelcome to manager systemn

4、);printf(1:Add newcard n2:Delete n3:Add moneyn4:Check moneyn0:Backn); printf(Please int 0-4:);scanf(%d,&choice);switch(choice)case 1:addcard();break;case 2:delcard();break;case 3:addmoney();break;case 4:checkmoney();break;case 0:return;break;default:printf(No this choice!n);break;getch();return;void

5、 stu_system()/*学生端管理系统*/int choice;while(1)printf(nWelcome to student systemn);printf(1:Guashin2:Jieguan3:Change passwordn4:Check moneyn0:Backn); printf(Please int 0-4:);scanf(%d,&choice);switch(choice)/*case 1: guashi();break;case 2:jiegua();break;*/case 3:changepassword();break;case 4:checkmoney()

6、;break;case 0:return;break;default:printf(Cant came true now!n);break;getch();return;void delcard()/* 删除旧卡 */int i;int cardnum;char choice;fp=fopen(card.txt,r);fp2=fopen(bookl.txt,w);printf(Please enter the number you want to delete:n); scanf(%d,&cardnum);for(i=0;fread(&cardi,sizeof(struct card1),1,

7、fp)!=0;i+) if(cardi.cardnum!=cardnum) fwrite(&cardi,sizeof(struct card1),1,fp2);fclose(fp);fclose(fp2);printf(Do you really want to delete this number(y/n) :nn); scanf(%s,&choice);if(choice=y|choice=Y)fp=fopen(card.txt,w);fp2=fopen(bookl.txt,r); for(i=0;fread(&cardi,sizeof(struct card1),1,fp2)!=0;i+

8、) fwrite(&cardi,sizeof(struct card1),1,fp);fclose(fp); fclose(fp2);fp2=fopen(bookl.txt,w); fclose(fp2);printf(Press any key to return.n); getch();return;elseprintf(Press any key to return.n);getch(); return;int k;fp=fopen(card.txt,a+); printf(Enter your number:n);flushall();scanf(%d,&cardi1.cardnum)

9、; flushall();printf(Enter your name:n); scanf(%s,&cardi1.studentname); flushall();printf(Enter your classnumber:n); scanf(%d,&cardi1.studentclass); flushall();cardi1.money=0;printf(Pleas e set your password in the form *:); for(k=0;k7;k+) cardi1.passwordk=getch(); printf(*);getch();printf(n); fwrite

10、(&cardi1,sizeof(struct card1),1,fp); fclose(fp);printf(Press any key to return.n);i1+; getch();int passwordl()/* 管理端密码 */char ch7,rig7=l,2,3,4,5,6,7;int time,i;for(time=0;time3;time+)printf(Please int your password in the form *:n);for(i=0;i7;i+) chi=getch();printf(*);if(ch0=rig0&chl=rigl&ch2=rig2&c

11、h3=rig3&ch4=rig4&ch5= rig5&ch6=rig6)return l;elseprintf(Your password is wrong,please int again !n); printf(Sorry,you cant enter manager system.n); return 0;void addmoney()/* 存钱 */FILE *fp,*fp2;int add,money,i,cardnum;fopen(card.txt,r); fopen(book.txt,w); printf(Please enter the cardnumber:); scanf(

12、%d,&cardnum); getch();for(i=0;(cardi.cardnum)!=cardnum);i+) if(strcmp(cardi.cardnum,cardnum)=O)/*判 断是否该卡 */ printf(How much would you like to add?:n); scanf(%d,&add);cardi.money+=add; fwrite(&cardi,sizeof(struct card1),1,fp2);else fwrite(&cardi,sizeof(struct card1),1,fp2);fclose(fp);fclose(fp2);fp=o

13、pen(card.txt,w); fp2=open(book.txt,r); for(i=0;fread(&cardi,sizeof(struct card1),1,fp2)!=0;i+) fwrite(&cardi,sizeof(struct card1),1,fp);fclose(fp);fclose(fp2);printf(Press any key to backn);getch();return;int cardnum,i; fp=fopen(card.txt,r); printf(Please enter the number you want to check:n); scanf(%d,&cardnum);for(i=0;fread(&cardi,sizeof(struct card1),1,fp)!=0;i+) if(strcmp(cardnum,cardi.cardnum)=0)printf(The money of this card is %d,cardi.money); return;printf(No this !n);fclose(fp);return;void changepassword()/* 修改密码*/FILE *fp,*fp2;int i,k,cardn

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 学术论文 > 其它学术论文

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号