



版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、#include#include#include#include#includestruct card1 /* 校園卡的數(shù)據(jù)類型*/int cardnum;char studentname10;int studentclass;int money;char password7;card100; TOC o 1-5 h z 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()/* 主函數(shù) */int choice;doprintf(n);printf(|n);Welcome to schoolcard system!printf(|nn);printf(n);printf(Please choose system:n);printf( systemn);printf( systemn);printf(Please int 1-2:);s
3、canf(%d,&choice);switch(choice) man_system();break;stu_system();break;default:printf(No this choice!);break;while(1);getch();return;void man_system()/* 管理端管理系統(tǒng)*/int choice;int ifright;ifright=password1();if(ifright=1)while(1)printf(nwelcome to manager systemn);moneyn4:Checkprintf(1:Addnewcard n2:Del
4、ete n3:Addmoneyn0:Backn);printf(Please int 0-4:);scanf(%d,&choice);switch(choice)addcard();break;delcard();break;addmoney();break;checkmoney();break;case 0:return;break;default:printf(No this choice!n);break;getch();return;void stu_system()/* 學生端管理系統(tǒng)*/int choice;while(1)printf(nWelcome to student sy
5、stemn);passwordn4:Checkprintf(1:Guashin2:Jieguan3:Change moneyn0:Backn);printf(Please int 0-4:);scanf(%d,&choice);switch(choice)/*case 1:guashi();break;jiegua();break;*/changepassword();break;checkmoney();break;case 0:return;break;default:printf(Cant came true now!n); break;getch(); return;void delc
6、ard()/* 刪除舊卡*/FILE *fp,*fp2;int i;int cardnum;char choice;fp=fopen(,r);fp2=fopen(,w);printf(Please enter the number you want to delete:n);scanf(%d,&cardnum);for(i=0;fread(&cardi,sizeof(struct card1),1,fp)!=0;i+)if(cardi.cardnum!=cardnum)fwrite(&cardi,sizeof(struct card1),1,fp2);fclose(fp);fclose(fp2
7、);printf(Do you really want to delete this number(y/n) :nn);scanf(%s,&choice);if(choice=y|choice=Y)fp=fopen(,w);fp2=fopen(,r);for(i=0;fread(&cardi,sizeof(struct card1),1,fp2)!=0;i+)fwrite(&cardi,sizeof(struct card1),1,fp);fclose(fp);fclose(fp2);fp2=fopen(,w);fclose(fp2);printf(Press any key to retur
8、n.n);getch();return;elseprintf(Press any key to return.n);getch();chi=getch();return;void addcard()/* 添加新卡*/FILE *fp;int k;fp=fopen(,a+);printf(Enter your number:n);flushall();scanf(%d,&cardi1.cardnum);flushall();printf(Enter your name:n);scanf(%s,&cardi1.studentname);flushall();printf(Enter your cl
9、assnumber: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(&cardi1,sizeof(struct card1),1,fp);fclose(fp);printf(Press any key to return.n);i1+;getch();int password1()
10、/* 管理端密碼*/char ch7,rig7=1,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+)printf(*);if(ch0=rig0&ch1=rig1&ch2=rig2&ch3=rig3&ch4=rig4&c h5=rig5&ch6=rig6)return 1;elseprintf(Your password is wrong,please int again !n);printf(Sorry,you cant en
11、ter manager system.n);return 0;void addmoney()/* 存錢 */FILE *fp,*fp2;int add,money,i,cardnum;fopen(,r);fopen(,w);printf(Please enter the cardnumber:);scanf(%d,&cardnum);getch();for(i=0;(cardi.cardnum)!=cardnum);i+)if(strcmp(cardi.cardnum,cardnum)=0)/*判斷是否該卡*/printf(How much would you like to add:n);s
12、canf(%d,&add);cardi.money+=add;fwrite(&cardi,sizeof(struct card1),1,fp2);elsefwrite(&cardi,sizeof(struct card1),1,fp2);fclose(fp);fclose(fp2);fp=open(,w);fp2=open(,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 a
13、ny key to backn);getch();return;void checkmoney()FILE *fp;int cardnum,i;fp=fopen(,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
14、;printf(No this !n);fclose(fp);return;void changepassword()/* 修改密碼*/FILE *fp,*fp2;int i,k,cardnum,ifright;fopen(,r);fopen(,w);printf(Please enter cardnumber:);scanf(%d,&cardnum);for(i=0;fread(&cardi,sizeof(struct card1),1,fp)!=0;i+)if(strcmp(cardi.cardnum,cardnum)=0)/*判斷是否該卡*/ifright=password2();if(
15、ifright=0)printf(nYour password is wrong!n);return;printf(Please enter your new password in the form of *:n);for(k=0;k7;k+)cardi.passwordk=getch();printf(*);printf(n);/*待改進 */fwrite(&cardi,sizeof(struct card1),1,fp2);continue;fwrite(&cardi,sizeof(struct card1),1,fp2);fclose(fp);fclose(fp2);fp=open(,w);fp2=open(,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 a
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 混凝土加工管理制度
- 燈具實驗室管理制度
- 烘焙店制度管理制度
- 家長如何輔助提高孩子學習成績的技巧
- 電力運行班管理制度
- 電廠存樣室管理制度
- 電器設(shè)計部管理制度
- 電暖氣使用管理制度
- 電工班現(xiàn)場管理制度
- 電視技術(shù)部管理制度
- 裂隙燈顯微鏡檢查
- 2024年中考物理試題及答案
- 中國Linux軟件行業(yè)市場發(fā)展現(xiàn)狀及前景趨勢與投資分析研究報告(2024-2030版)
- 《新能源乘用車二手車鑒定評估技術(shù)規(guī)范 第1部分:純電動》
- 下沉式廣場結(jié)構(gòu)施工方案
- 《加坡的教育制度》課件
- Windows操作系統(tǒng)及應(yīng)用期末測試試題及答案
- 2025年國家知識產(chǎn)權(quán)局商標審查協(xié)作中心招聘60人高頻重點提升(共500題)附帶答案詳解
- 《交通事故車輛及財物損失價格鑒證評估技術(shù)規(guī)范》
- 有源醫(yī)療器械現(xiàn)場檢查
- 品管圈PDCA改善案例-降低住院患者跌倒發(fā)生率
評論
0/150
提交評論