學(xué)生管理系統(tǒng)源代碼_第1頁
學(xué)生管理系統(tǒng)源代碼_第2頁
學(xué)生管理系統(tǒng)源代碼_第3頁
學(xué)生管理系統(tǒng)源代碼_第4頁
學(xué)生管理系統(tǒng)源代碼_第5頁
已閱讀5頁,還剩16頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

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_N

2、ame(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 STUDENTint num;char name20;char sex;float s

3、coreSUBJECT_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(sizeof(S

4、TUDENT)*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.score1 = 90.0;rec

5、ord2.score2 = 95.0;record3.num = 1003;strcpy(,"J essie");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;coutcin>>targetNum;modify_Num(targetNum);cout<&l

6、t;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<<"*cout<<"cout<<"cout<<"cout<<

7、;"cout<<"Made by Jasoncout<<"*"<<endl;"<<endl;"<<endl;"<<endl;"<<endl;"<<endl;"<<endl;/.void show_Table()cout<<" <<"t"<<" "<<"t"<<&

8、quot; cout<<"t"<<subject0<<"t"<<subject1<<"t"<<subject2;cout<<endl;void menu_CMD()int key;while(1)cout<<"1.<<endl;cout<<"2.<<endl;cout<<"3.<<endl;cout<<"4.<<end

9、l;cout<<"5.<<endl;cout<<"6.<<endl;cout<<"cin>>key;while(1)if(key < 1)|(key > 6)int key;cout<<"<<endl;cout<<(1-5):"cin>>key;elsebreak;switch(key)case 1:addRecord();break;case 2:deleteRecord();break;case 3:modif

10、yRecord();break;case 4:queryRecord();break;case 5:display();break;case 6:quit();break;/void addRecord()if(stuNum = 0)cout<<<<endl;stuNum+;elsecout<<"<<endl;stuNum+;/if(stuNum > INIT_SIZE)cout<<"<<endl;record = (STUDENT*)realloc(record,(INIT_SIZE +cout

11、<<"!"<<endl;cout<<"<<endl;cout<<"(Y/N) : "char choi;cin>>choi;if(choi = 'Y')|(choi = 'y')cout<<": "cin>>recordstuNum.num;cout<<": "cin>>recordstuN;cout<<"(M,F):&

12、quot;cin>>recordstuNum.sex;int i;for(i = 0;i < SUBJECT_NUM;i+)cout<<" "<<subjecti<< cin>>recordstuNum.scorei;: "if(choi = 'N')|(choi = 'n')cout<<"<<endl;cout<<endl;cout<<<<stuNum<<"!"&l

13、t;<endl;cout<<endl;/ /deleteRecord void Info_delete()cout<<": "<<endl;cout<<"1."<<endl;cout<<"2.<<endl;cout<<"3."<<endl;/void deleteRecord()int key;cout<<endl;Info_delete();cout<<": "cin

14、>>key;if(key = 1)int targetNum;cout<<": "cin>>targetNum;/delete_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)

15、int i;for(i = 1;i <= stuNum;i+)if(recordi.num = tarNum)/1./2.if(i = stuNum)cout<<": "<<endl;show_Table();cout<<recordi.num<<"t"<<<<"t"<<recordi.sex<<"t"<<recordi.score0<<recordi.score1&

16、lt;<"t"<<recordi.score2; cout<<endl;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;

17、j+) cout<<"t"<<recordi.scorej;cout<<endl;/*stuNum-;cout<<"<<stuNum<<"cout<<endl;*/2.if(i != stuNum)cout<<": "<<endl;show_Table();cout<<recordi.num<<"t"<<<<"t"&l

18、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<<": "<<endl;show_Table();for(int i = 1;i <= stuNum-

19、1;i+)cout<<recordi.num<<"t"<<<<"t"<<recordi.sex; for(int j = 0;j < SUBJECT_NUM;j+) cout<<"t"<<recordi.scorej;cout<<endl;/*stuNum-;cout<<""<<stuNum<<"cout<<endl;*/stuNum

20、-;cout<<""<<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"<<recordi

21、.name<<"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<&

22、lt;"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"<<r

23、<<"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<<": "<<endl;show_Ta

24、ble();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_Name(char tarName)int i

25、;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"<<recordi.score0<<&qu

26、ot;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"<<recordi.sex; for(int j = 0;j

27、 < SUBJECT_NUM;j+) cout<<"t"<<recordi.scorej;cout<<endl;/*stuNum-;cout<<""<<stuNum<<""cout<<endl;*/if(i != stuNum)cout<<""<<endl;show_Table();cout<<recordi.num<<"t"<<recordi.n

28、ame<<"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 = recordj;/.cout<<endl;cout<<": "<<

29、;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;/*stuNum-;cout<<""<&

30、lt;stuNum<<cout<<endl;*/stuNum-;cout<<"<<stuNum<<"cout<<endl;/* */void Info_modify()cout<<":"<<endl;cout<<"1."<<endl;cout<<"2."<<endl;cout<<"3."<<endl;void modifyReco

31、rd()int key;cout<<endl;Info_modify();cout<<": "cin>>key;/if(key = 1)int targetNum;cout<< : "cin>>targetNum;modify_Num(targetNum);cout<<endl;/display();/if(key = 2)char targetName20;cout<<: "cin>>targetName;modify_Name(targetName);co

32、ut<<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<<""<<endl;cout<<": "cin>>recordi.num;cout<<": "cin>>;cout<&l

33、t;"cin>>recordi.sex;cout<<""<<subject0<<" "cin>>recordi.score0;cout<<""<<subject1<<" : "cin>>recordi.score1;cout<<""<<subject2<< "cin>>recordi.score2;void modify_

34、Name(char tarName)int i;for(i = 1;i <= stuNum;i+)if(strcmp(,tarName) = 0)cout<<endl<<": "<<endl;cout<<": "cin>>recordi.num;cout<<": "cin>>;cout<<": "cin>>recordi.sex;cout<<&

35、quot;"<<subject0<<": "cin>>recordi.score0;cout<<""<<subject1<<": "cin>>recordi.score1;cout<<""<<subject2<<": "cin>>recordi.score2;void Info_query()cout<<": "<&l

36、t;endl;cout<<"1."<<endl;cout<<"2."<<endl;cout<<"3."<<endl;/queryRecordvoid queryRecord()int key;cout<<endl;Info_query();cout<<""cin>>key;if(key = 1)int targetNum;cout<<": "cin>>targetN

37、um;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();voidquery_Num(int tarNum)int i;for(i = 1;i <= stuNum;i+)if(recordi.num = tarNum)/ cout<<" : "<<endl;/show_Table();/ cout<<recordi.num<<"t"<&l

溫馨提示

  • 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)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論