版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、【源代碼】#include#includeusing namespace std;#define N 10class Student /每個(gè)學(xué)生的信息public:char name10;char sex;char college10;char item10;int position;int score;void menu(); /全局函數(shù)聲明Student stuN; /實(shí)例化出一個(gè)對(duì)象數(shù)組void writein() /輸入學(xué)生信息 int i,n,M,W;coutn;coutM; coutW; cout輸入完畢!請(qǐng)繼續(xù)輸入?yún)①悓W(xué)生信息:endl; /初始化輸入 coutendl;for(
2、i=0;iN;i+); loop_1:coutstui.sex;if(stui.sex!=m&stui.sex!=w)cout性別輸入錯(cuò)誤!endl; goto loop_1; coutstui.college; coutstui.item;coutstui.position;coutstui.score; coutendl;coutendl; cout輸入完畢!請(qǐng)選擇下一步操作:endl;menu(); /主菜單函數(shù)調(diào)用void search() /查詢(xún)信息int m;void search_college(); /按學(xué)院查詢(xún)的函數(shù)聲明void search_ite
3、m(); /按項(xiàng)目查詢(xún)的函數(shù)聲明void search_name(); /按姓名查詢(xún)的函數(shù)聲明cout請(qǐng)選擇查詢(xún)方式:endl;cout*1、按院系查詢(xún)*endl; cout*2、按項(xiàng)目查詢(xún)*endl;cout*3、按姓名查詢(xún)*endl;cout*4、返回主菜單*endl;coutendl;cout=endl;coutm;if(m=1)search_college(); /按學(xué)院查詢(xún)的函數(shù)else if(m=2)search_item(); /按項(xiàng)目查詢(xún)的函數(shù)else if(m=3)search_name(); /按名字查詢(xún)的函數(shù)else if(m=4)menu(); /返回主菜單elseco
4、ut請(qǐng)輸入正確的序號(hào)!endl;search(); /錯(cuò)誤提示并返回查詢(xún)菜單void search_college() /按學(xué)院查詢(xún)int a,m_score=0,w_score=0,sum=0,flag;Student s;couts.college;cout姓名 性別 參賽項(xiàng)目 名次 得分endl; for(a=0;aN;a+)if(strcmp(s.college,stua.college)=0) /調(diào)用student類(lèi)的對(duì)象if(stua.sex=m)m_score+=stua.score; stua.sex stua.item stua.position s
5、tua.scoreendl;elsew_score+=stua.score; stua.sex stua.item stua.position stua.scoreendl;flag=1;if(flag!=1)cout對(duì)不起,該學(xué)院沒(méi)有參加運(yùn)動(dòng)會(huì)!請(qǐng)重新輸入!endl;search();sum=m_score+w_score;cout該學(xué)院總分:sumendl;cout男子得分:m_scoreendl;cout女子得分:w_scoreendl;cout=endl;coutendl;cout請(qǐng)選擇下一步操作:endl;search();void search_item
6、() /按項(xiàng)目查詢(xún)int b,flag;Student x;coutx.item;cout姓名 性別 院系 名次 得分endl; for(b=0;bN;b+)if(strcmp(x.item,stub.item)=0) /調(diào)用student類(lèi)的對(duì)象 stub.sex stub.college stub.position stub.scoreendl;flag=1;if(flag!=1)cout對(duì)不起,沒(méi)有該項(xiàng)目!請(qǐng)重新輸入!endl;search();cout=endl;coutendl;cout請(qǐng)選擇下一步操作:endl;search();void search_n
7、ame() /按姓名查詢(xún)int c,flag;Student y;;cout性別 院系 參賽項(xiàng)目 名次 得分endl; for(c=0;cN;c+)if(strcmp(,)=0) /調(diào)用student類(lèi)的對(duì)象coutstuc.sex stuc.college stuc.item stuc.position stuc.scoreendl;flag=1;if(flag!=1)cout對(duì)不起,該學(xué)生沒(méi)有參加運(yùn)動(dòng)會(huì)!請(qǐng)重新輸入!endl;search();cout=endl;coutendl;cout請(qǐng)選擇下一步操作:endl;search();voi
8、d exit() cout* * * * * * * * * * * * * * * * * *endl;cout * * * * * * * * * * * * * * *endl;cout * * * * * * * * * * * * * * * *endl; cout * * * * * * * * * * * * *endl;cout * * * * * * * * * * * * * * *endl; cout * * * * * * * * * * * * * *endl; cout * * * * * * * * * * * * * * * * * *endl; coutend
9、l; void menu() /主菜單int n;coutendl;cout=歡迎使用學(xué)校運(yùn)動(dòng)會(huì)管理系統(tǒng)=endl;coutendl;cout*1.輸入信息*endl;cout*2.查詢(xún)信息*endl;cout*3.退出系統(tǒng)*endl;coutendl;cout=endl;coutn;if(n=1)writein();else if(n=2)search();else if(n=3)exit();exit(0);elsecout請(qǐng)輸入正確的序號(hào)!endl;menu();void welcome()char y5; cout *endl; cout * # # # *endl; cout * #
10、 # # # # # # # # # # # *endl; cout * # # # # # # # # # # # # # # # # # # # # # # # *endl; cout * # # # # # # # # # # # # # # # # # # # *endl; cout * # # # # # # # # # # # # # # # # # *endl; cout * # # # # # # # # # # # # # # # *endl; cout * # # # # # # # # # # # # *endl; cout * # # # # # # # # # # # *endl; cout * # # # # # # # # # # # # # #
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 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ì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年高職酒店管理(宴會(huì)策劃執(zhí)行)試題及答案
- 2025年高職(物聯(lián)網(wǎng)應(yīng)用技術(shù))工業(yè)物聯(lián)網(wǎng)實(shí)務(wù)試題及答案
- 2025年高職商務(wù)管理(商務(wù)談判)試題及答案
- 2026年廣告策劃(文案優(yōu)化)試題及答案
- 2026年手臂按摩儀項(xiàng)目評(píng)估報(bào)告
- 2025年中職(油脂工程技術(shù))油脂制取綜合測(cè)試題及答案
- 2025年中職小學(xué)教育(小學(xué)生安全教育)試題及答案
- 2025年高職物聯(lián)網(wǎng)(物聯(lián)網(wǎng)終端調(diào)試)試題及答案
- 2025年大學(xué)大三(智能電網(wǎng)信息工程)電力系統(tǒng)自動(dòng)化技術(shù)試題及答案
- 2025年中職電氣(電氣控制基礎(chǔ))試題及答案
- LYT 2085-2013 森林火災(zāi)損失評(píng)估技術(shù)規(guī)范
- 材料樣品確認(rèn)單
- 彝族文化和幼兒園課程結(jié)合的研究獲獎(jiǎng)科研報(bào)告
- 空調(diào)安裝免責(zé)協(xié)議
- 《傳感器與檢測(cè)技術(shù)》試題及答案
- 湖北省襄樊市樊城區(qū)2023-2024學(xué)年數(shù)學(xué)四年級(jí)第一學(xué)期期末質(zhì)量檢測(cè)試題含答案
- 初中班會(huì)主題課件科學(xué)的復(fù)習(xí)事半功倍(共23張PPT)
- PCB封裝設(shè)計(jì)規(guī)范
- GB/T 9349-2002聚氯乙烯、相關(guān)含氯均聚物和共聚物及其共混物熱穩(wěn)定性的測(cè)定變色法
- GB/T 32473-2016凝結(jié)水精處理用離子交換樹(shù)脂
- 《水利水電工程等級(jí)劃分及洪水標(biāo)準(zhǔn)》 SL252-2000
評(píng)論
0/150
提交評(píng)論