版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、#include<iostream>#include<stdlib.h>#include<string.h>#include<malloc.h>#define INIT_SIZE 10 #define INCRE_SIZE 10 #define SUBJECT_NUM 3#define LEN 3void show_Start();void show_Table();void addRecord();void Info_delete();void deleteRecord();void delete_Num(int);void delete_Na
2、me(char tarName);void Info_modify();void modifyRecord();void modify_Num(int);void modify_Name(char);void Info_query();void queryRecord();void query_Num(int);void query_Name(char);void display();void quit();void menu_CMD();char *subjectSUBJECT_NUM = struct STUDENT int num; char name20; char sex; floa
3、t scoreSUBJECT_NUM; /struct STUDENT stuLEN + 1;/STUDENT *record = (STUDENT*)malloc(sizeof(STUDENT)*INIT_SIZE);int static stuNum = 0; /STUDENT *record = (STUDENT*)malloc(sizeof(STUDENT)*INIT_SIZE);int main() /record = (STUDENT*)malloc(sizeof(STUDENT)*INIT_SIZE); /STUDENT *record = (STUDENT*)malloc(si
4、zeof(STUDENT)*INIT_SIZE);/* record1.num = 1001; strcpy(,"Jason"); record1.sex = 'M' record1.score0 = 85.0; record1.score1 = 90.0; record1.score2 = 95.0;record2.num = 1002; strcpy(,"Jerry"); record2.sex = 'M' record2.score0 = 85.0; record2.s
5、core1 = 90.0; record2.score2 = 95.0;record3.num = 1003; strcpy(,"Jessie"); record3.sex = 'F' record3.score0 = 85.0; record3.score1 = 90.0; record3.score2 = 95.0;*/* Info_modify(); int key; cout< cin>>key; if(key = 1) int targetNum; cout cin>>targetNum; mo
6、dify_Num(targetNum); cout<<endl; display(); if(key = 2) char targetName20; cout< cin>>targetName; modify_Name(targetName); cout<<endl; display(); if(key = 3) exit(0); */ show_Start();menu_CMD();return 0; void show_Start() /cout<<endl; cout<<" * "<<end
7、l; cout<<" "<<endl; cout<<" "<<endl; cout<<" "<<endl; cout<<" "<<endl; cout<<" Made by Jason "<<endl; cout<<" * "<<endl;/. void show_Table() cout<<" <<
8、"t"<<" "<<"t"<<" cout<<"t"<<subject0<<"t"<<subject1<<"t"<<subject2; cout<<endl; void menu_CMD() int key; while(1) cout<<"1. <<endl; cout<<"2. <&
9、lt;endl; cout<<"3. <<endl; cout<<"4. <<endl; cout<<"5. <<endl; cout<<"6. <<endl; cout<<" cin>>key; while(1) if(key < 1)|(key > 6) int key; cout<< "<<endl; cout<< (1 - 5) : " cin>
10、>key; else break; switch(key) case 1: addRecord(); break; case 2: deleteRecord(); break; case 3: modifyRecord(); break; case 4: queryRecord(); break; case 5: display(); break; case 6: quit(); break; /void addRecord()if(stuNum = 0) cout<< <<endl; stuNum+; else cout<<" <&l
11、t;endl; stuNum+; / if(stuNum > INIT_SIZE) cout<< "<<endl; record = (STUDENT*)realloc(record,(INIT_SIZE + INCRE_SIZE)*sizeof(STUDENT); cout<<" !"<<endl; cout<<" <<endl; cout<<" (Y/N) : " char choi; cin>>choi; if(choi = &
12、#39;Y')|(choi = 'y') cout<<" : " cin>>recordstuNum.num; cout<<" : " cin>>recordstuN; cout<<"(M , F) : " cin>>recordstuNum.sex; int i; for(i = 0;i < SUBJECT_NUM;i+) cout<<" "<<subjecti<<
13、; : " cin>>recordstuNum.scorei; if(choi = 'N')|(choi = 'n') cout<<" <<endl; cout<<endl; cout<< <<stuNum<<" !"<<endl; cout<<endl;/ /deleteRecord void Info_delete() cout<<" : "<<endl; cout&l
14、t;<"1. "<<endl; cout<<"2. <<endl; cout<<"3. "<<endl;/ void deleteRecord() int key; cout<<endl; Info_delete(); cout<<" : " cin>>key; if(key = 1) int targetNum; cout<<" : " cin>>targetNum; / del
15、ete_Num(targetNum); cout<<endl; if(key = 2) char targetName20; cout<<" : " cin>>targetName; delete_Name(targetName); cout<<endl; if(key = 3) while(1) menu_CMD(); / void delete_Num(int tarNum) int i; for(i = 1;i <= stuNum;i+) if(recordi.num = tarNum) / /1. /2. if(
16、i = stuNum) cout<<" : "<<endl; show_Table(); cout<<recordi.num<<"t"<<<<"t"<<recordi.sex<<"t" <<recordi.score0<<recordi.score1<<"t"<<recordi.score2; cout<<endl;
17、cout<<endl<<" : "<<endl; show_Table(); for(int i = 1;i <= stuNum - 1;i+) cout<<recordi.num<<"t"<<<<"t"<<recordi.sex; for(int j = 0;j < SUBJECT_NUM;j+) cout<<"t"<<recordi.scorej; cout
18、<<endl; /* stuNum-; cout<<" <<stuNum<<" cout<<endl; */ /2. if(i != stuNum) cout<<" : "<<endl; show_Table(); cout<<recordi.num<<"t"<<<<"t"<<recordi.sex<<"t" <
19、<recordi.score0<<"t"<<recordi.score1<<"t"<<recordi.score2; for(int j = i+1;j <= stuNum;j+) recordj-1 = recordj; / cout<<endl; cout<<" : "<<endl; show_Table(); for(int i = 1;i <= stuNum-1;i+) cout<<recordi.num<&
20、lt;"t"<<<<"t"<<recordi.sex; for(int j = 0;j < SUBJECT_NUM;j+) cout<<"t"<<recordi.scorej; cout<<endl; /* stuNum-; cout<<" "<<stuNum<<" cout<<endl; */ stuNum-; cout<<" &qu
21、ot;<<stuNum<< cout<<endl; /*/void delete_Name(char tarName) int i; for(i = 1;i <= stuNum;i+) if(strcmp(,tarName) = 0) / /1. /2. / if(i = stuNum) cout<<" : "<<endl; show_Table(); cout<<recordi.num<<"t"<<<
22、;<"t"<<recordi.sex<<"t" <<recordi.score0<<recordi.score1<<"t"<<recordi.score2; cout<<endl; cout<<endl<<" : "<<endl; show_Table(); for(int i = 1;i <= stuNum - 1;i+) cout<<recordi.num<<
23、;"t"<<<<"t"<<recordi.sex; for(int j = 0;j < SUBJECT_NUM;j+) cout<<"t"<<recordi.scorej; cout<<endl; / if(i != stuNum) cout<<" : "<<endl; show_Table(); cout<<recordi.num<<"t"<
24、;<<<"t"<<recordi.sex<<"t" <<recordi.score0<<"t"<<recordi.score1<<"t"<<recordi.score2; / for(int j = i+1;j <= stuNum;j+) recordj-1 = recordj; cout<<endl; / cout<<" : "<&l
25、t;endl; show_Table(); for(int i = 1;i <= stuNum-1;i+) cout<<recordi.num<<"t"<<<<"t"<<recordi.sex; for(int j = 0;j < SUBJECT_NUM;j+) cout<<"t"<<recordi.scorej; cout<<endl; cout<<endl; void delete_Nam
26、e(char tarName) int i; for(i = 1;i <= stuNum;i+) / /1. /2. / if(strcmp(,tarName) = 0) if(i = stuNum) cout<<" : "<<endl; show_Table(); cout<<recordi.num<<"t"<<<<"t"<<recordi.sex<<"t" <
27、;<recordi.score0<<"t"<<recordi.score1<<"t"<<recordi.score2; cout<<endl; cout<<" : "<<endl; show_Table(); for(int i = 1;i <= stuNum-1;i+) cout<<recordi.num<<"t"<<<<"t"
28、<<recordi.sex; for(int j = 0;j < SUBJECT_NUM;j+) cout<<"t"<<recordi.scorej; cout<<endl; /* stuNum-; cout<<" "<<stuNum<<" " cout<<endl; */ / if(i != stuNum) cout<<" "<<endl; show_Table(); cout<&l
29、t;recordi.num<<"t"<<<<"t"<<recordi.sex<<"t" cout<<recordi.score0<<"t"<<recordi.score1<<"t"<<recordi.score2; cout<<endl; for(int j = i+1;j <= stuNum;j+) recordj-1 = recor
30、dj; /. cout<<endl; cout<<" : "<<endl; show_Table(); for(int i = 1;i <= stuNum-1;i+) cout<<recordi.num<<"t"<<<<"t"<<recordi.sex; for(int j = 0;j < SUBJECT_NUM;j+) cout<<"t"<<recordi.s
31、corej; cout<<endl; /* stuNum-; cout<<" "<<stuNum<< cout<<endl; */ stuNum-; cout<<" <<stuNum<< " cout<<endl; /*/void Info_modify() cout<<" : "<<endl; cout<<"1. "<<endl; cout<<&q
32、uot;2. "<<endl; cout<<"3. "<<endl; void modifyRecord() int key; cout<<endl; Info_modify(); cout<<" : " cin>>key;/ if(key = 1) int targetNum; cout<< : " cin>>targetNum; modify_Num(targetNum); cout<<endl; /display(); /
33、 if(key = 2) char targetName20; cout<< : " cin>>targetName; modify_Name(targetName); cout<<endl; /display(); if(key = 3) while(1) menu_CMD(); /void modify_Num(int tarNum) int i; for(i = 1;i <= stuNum;i+) if(recordi.num = tarNum) cout<<endl<<" "<<
34、endl; cout<<" : " cin>>recordi.num; cout<<" : " cin>>; cout<<" cin>>recordi.sex; cout<<" "<<subject0<<" " cin>>recordi.score0; cout<<" "<<subject1<<"
35、: " cin>>recordi.score1; cout<<" "<<subject2<< " cin>>recordi.score2; void modify_Name(char tarName) int i; for(i = 1;i <= stuNum;i+) if(strcmp(,tarName) = 0) cout<<endl<<" : "<<endl; cout<<" : &q
36、uot; cin>>recordi.num; cout<<" : " cin>>; cout<<" : " cin>>recordi.sex; cout<<" "<<subject0<<" : " cin>>recordi.score0; cout<<" "<<subject1<<" : " cin>&g
37、t;recordi.score1; cout<<" "<<subject2<<" : " cin>>recordi.score2; void Info_query() cout<<" : "<<endl; cout<<"1. "<<endl; cout<<"2. "<<endl; cout<<"3. "<<endl; /queryRe
38、cord void queryRecord() int key; cout<<endl; Info_query(); cout<<" " cin>>key; if(key = 1) int targetNum; cout<<" : " cin>>targetNum; query_Num(targetNum); cout<<endl; if(key = 2) char targetName20; cout<<" : " cin>>targetName; query_Name(targetName); cout<<endl; / . if(key = 3) while(1) menu_CMD(); void query_Num(int tarNum) int i; for(i = 1;i <= stuNum;i+) if(recordi.num = tarNum) / cout<<" : "<<endl; / show_Table(); / cout<<recordi.num&l
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 銷(xiāo)售總結(jié)課件教學(xué)課件
- 紅火蟻的預(yù)防與治療
- 教育培訓(xùn)機(jī)構(gòu)的年終總結(jié)
- 第二章 相互作用-三種常見(jiàn)力 2025年高考物理基礎(chǔ)專(zhuān)項(xiàng)復(fù)習(xí)
- 侵襲性肺曲霉菌病診治指南
- 氧化碳的制取的研究說(shuō)課稿
- 好玩的磁鐵說(shuō)課稿
- 農(nóng)村水上運(yùn)動(dòng)中心建設(shè)合同協(xié)議書(shū)
- 污水處理廠標(biāo)識(shí)系統(tǒng)招投標(biāo)文件
- 投資合伙人合同協(xié)議書(shū)
- 安徽省A10聯(lián)盟2024-2025學(xué)年高三上學(xué)期開(kāi)學(xué)考試生物試題(解析版)
- 2022-2023學(xué)年北京市海淀區(qū)中關(guān)村中學(xué)八年級(jí)(上)期中數(shù)學(xué)試卷【含解析】
- 2.1 認(rèn)識(shí)自己 課件-2024-2025學(xué)年道德與法治七年級(jí)上冊(cè)(統(tǒng)編版2024)
- 5.5《方程的意義》(課件)-2024-2025學(xué)年人教版數(shù)學(xué)五年級(jí)上冊(cè)
- 2021新青島版六三制三年級(jí)上冊(cè)科學(xué)全冊(cè)知識(shí)點(diǎn)總結(jié)期末復(fù)習(xí)背誦資料
- 部編版二年級(jí)語(yǔ)文上冊(cè)看拼音寫(xiě)詞語(yǔ)含答案
- 2024年浙江省應(yīng)急管理行政執(zhí)法競(jìng)賽題庫(kù)-上(單選、多選題)
- 四肢關(guān)節(jié)病癥推拿治療-梨狀肌綜合癥患者的推拿治療
- 房產(chǎn)開(kāi)發(fā)地塊收購(gòu)項(xiàng)目可行性研究報(bào)告(完美版)
- JJF 2133-2024海洋資料浮標(biāo)傳感器校準(zhǔn)規(guī)范
- HGT 6333-2024《煤氣化灰水阻垢分散劑阻垢性能測(cè)定方法》
評(píng)論
0/150
提交評(píng)論