


版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、學(xué)生課程設(shè)計(jì)報(bào)告課程設(shè)計(jì)題目: 學(xué)生信息管理 系 統(tǒng)課程設(shè)計(jì)內(nèi)容通過一個(gè)系統(tǒng)窗口,選擇要執(zhí)行的功能:(1) 成績的錄入,依次輸入學(xué)生的個(gè)數(shù),學(xué)號(hào),姓名三 門成績;( 2) 成績的查詢(學(xué)號(hào)或姓名);( 3) 成績統(tǒng)計(jì) (平均成績 );(4) 成績按平均分排名;( 5) 任意鍵退出技術(shù)路線利用 C 語言編寫程序,構(gòu)造結(jié)構(gòu)體,構(gòu)造及調(diào)用函數(shù)實(shí)現(xiàn)這些功能。三、設(shè)計(jì)和實(shí)現(xiàn)/*頭文件 */#include <stdio.h>#include <string.h>#include <stdlib.h>/*常量 */#define MENU_NUM 7#define N
2、3#define MAX 100/記錄的最大數(shù)量/*結(jié)構(gòu)體 */struct studentcharno10 ;/*學(xué)號(hào)由 10個(gè)字符組成 */charname15 ;/*學(xué)生姓名 */floatscoreN ;/*各門課成績 */float sum ;/*總分 */float average ;/*平均分 */;全局變量 *記錄學(xué)生總?cè)藬?shù)/ 記錄學(xué)生信息int count ; / struct student studMAX;/*函數(shù)聲明 *int cmp(const void * a , const void * b ); /void input();/void output();/voi
3、d PrintMenu();/void computer();/void find();void sort();輸入學(xué)生信息輸出學(xué)生信息顯示菜單計(jì)算學(xué)生成績/ 根據(jù)學(xué)號(hào)或姓名查詢成績/ 成績排名排序規(guī)則主函數(shù) *void main()int choose ; count = 0;while(1)PrintMenu();scanf("%d",&choose);switch(choose)case 1 :input(); /break ;case 2 :find(); /break ;case 3 :computer(); /break ;case 4 :/ sort(
4、); /輸入成績查詢成績統(tǒng)計(jì)成績按成績排序,按名次輸出成績調(diào)用庫函數(shù)中的qsort(stud,count,sizeof(struct student),cmp); /排序方法output(); break ;case 5 :exit(0); printf("nn");排序規(guī)則 *int cmp(const void * a , const void * b )struct student *aa = (struct student *)a ;struct student *bb = (struct student *)b ;if( aa->sum != bb->
5、sum ) return aa->sum < bb->sum ? 1 : -1;else if(aa->score0 != bb->score0)return aa->score0 < bb->score0 ? 1 : -1; return aa->score2 < bb->score2 ? 1 : -1;return 0 ;/* 函 數(shù) 名: PrintMenu* 描述:顯示操作菜單* 入口參數(shù):無* 出口參數(shù):無* void PrintMenu()printf("n");printf("|學(xué)生成
6、績管理系統(tǒng)|n");printf("|1成績錄入 |n");printf("|2成績查詢 ( 學(xué)號(hào)或姓名 )|n")printf("|3成績統(tǒng)計(jì) ( 平均成績 )|n");printf("|4成績排名 |n");printf("|5任意鍵退出 |n");printf("-");printf("n");printf("n");printf("請輸入您要進(jìn)行的操作: ");/* 函 數(shù) 名: input描 述:
7、輸入學(xué)生信息* 入口參數(shù):無* 出口參數(shù):無*void input()int n,i ;float temp ;printf(" 請輸入要錄入的學(xué)生的人數(shù): ");scanf("%d",&n);for(i=0;i<n;i+)printf(" 輸入第 %d 個(gè)學(xué)生信息 n",i+1);printf(" 學(xué)號(hào): ");scanf("%s",studcount+i.no);printf(" 姓名: "); scanf("%s",studcount+
8、);printf(" 成績 1 : ");scanf("%f",&studcount+i.score0);printf(" 成績 2:");scanf("%f",&studcount+i.score1);printf(" 成績 3:");scanf("%f",&studcount+i.score2);count += n ;/* 函 數(shù) 名: find* 描 述:根據(jù)學(xué)號(hào)或姓名查詢成績* 入口參數(shù):無* 出口參數(shù):無*void find()
9、int i ;char ch15;printf(" 請輸入學(xué)號(hào)或姓名: ");scanf("%s",ch);printf("n");printf("|學(xué)號(hào)| 姓名|成績1|成績2|成績引總分|平均分|n");for(i=0;i<count;i+)if( !strcmp(ch,studi.no) | !strcmp(ch,) ) i.score2,studi.sum,studi.average); printf("n");return ;printf(" 沒有找
10、到該學(xué)生的信息 !n"); printf("n"); /* *函 數(shù) 名: computer* 描述:計(jì)算學(xué)生總成績和平均成績* 入口參數(shù):無* 出口參數(shù):無 */ void computer()int i ;for(i = 0 ; i < count ; i + ) studi.sum = studi.score0 +studi.score1 +studi.score2 ; studi.average = (studi.score0 +studi.score1 +studi.score2)/N;output(); /* *函 數(shù) 名: output* 描述
11、:輸出學(xué)生所有信息* 入口參數(shù):無* 出口參數(shù):無*void output()int i ;printf("n");printf("| 學(xué)號(hào) | 姓名 | 成績1| 成績2| 成績3| 總分 | 平均分 |n"); studi.no,,studi.score0,studi.score1,studi.score2,studi.sum,studi.average);printf("n");/* 函 數(shù) 名: sort* 描 述:排序* 入口參數(shù):無* 出口參數(shù):無*/void sort()for(i = 0 ; i &
12、lt; count-1 ; i +)studi.sum = studi.score0 + studi.score1 + studi.score2 ; studi.average = (studi.score0 + studi.score1 + studi.score2)/3; k = i ;for(j = i + 1 ; j < count ; j +)if(studk.sum < studj.sum) k = j ;if(k != i)temp = studi; studi = studk; studk = temp;printf(" 學(xué)生成績排名 n");
13、printf(" 按名次 n"); output();四、測試結(jié)果(2) I I I I _ - -> 一充名> 一物姓績 -里 豆尺 _ 一詐I 一績腎出 一成入詢計(jì)名退一 一生錄查統(tǒng)翟 一學(xué)績績績書一 一 成成成成任一* -一 1 2 3 4 5 _ - - - 一 :_11H81PB1h|i11:學(xué)號(hào);姓名;成績1;成績2喊績3;總分 呼均分;1201201:lidannins: 90.0: 89.3; 805:0叭6.0:學(xué)生威績菅埋系統(tǒng) 成績莖入 成績舍詢 成績統(tǒng)計(jì)t2345A= 3氧lai4入入簣-號(hào)名績績契號(hào)名績績賈號(hào)名績績績H1Q9 w 9 ?
14、8 3s s sg 3 1g 123= £123說紳辭蹲縣聽取!專業(yè)定做其它設(shè)計(jì)送冃請了的操作:2 生名:lidanning; 學(xué)號(hào): 姓名;成績"成績2:成績典總分:平均分:J 231201: lidannin?: 90.0: 89.0: 80.00.0:0.9:成成咸成任一昌 < < 出 一 退 iw麗 一迸霍績曇2 成成成成任-充 -自. 一慕 一昜 -里 -理 匸弓 一璉 一五貝 -月羔.-學(xué)生成績萱理系統(tǒng)排茗賤退出請埼入您要進(jìn)行占揀作 3學(xué)號(hào): 姓名;成績空成績21成績3:總分;平均分I2B1201IlidannlnBl 9B.0IS9.BI»0.01259.0186.31261202 tdanslan * ?1-0:90.1d9,;27d.0::281203;liujuan:100.0!90.Of93,3:283.S!94.3!(4)ESI請輸入您要進(jìn)疔旳操作:4:學(xué)號(hào): 姓名:成績:成績2 !成績3 !總分:平均分!I201203 Iliujuan H00.B!90.0193aB!283.0!94.3II201202 Idonul&n I 91.0:99.0169.01270.0198.09I201201 Ilidannlng: 90.0:B9.0I80.B3 259.B:86.3I(5)統(tǒng) 系 rm -
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 浙江汽車職業(yè)技術(shù)學(xué)院《深度報(bào)道研究》2023-2024學(xué)年第二學(xué)期期末試卷
- 黑龍江林業(yè)職業(yè)技術(shù)學(xué)院《信息系統(tǒng)開發(fā)與應(yīng)用綜合專題》2023-2024學(xué)年第二學(xué)期期末試卷
- 河北醫(yī)科大學(xué)臨床學(xué)院《土地規(guī)劃設(shè)計(jì)》2023-2024學(xué)年第二學(xué)期期末試卷
- 重慶信息技術(shù)職業(yè)學(xué)院《環(huán)境與健康》2023-2024學(xué)年第二學(xué)期期末試卷
- 新疆維吾爾醫(yī)學(xué)??茖W(xué)校《衛(wèi)生監(jiān)督學(xué)A》2023-2024學(xué)年第二學(xué)期期末試卷
- 晉中師范高等??茖W(xué)?!稒C(jī)械基礎(chǔ)與液壓傳動(dòng)》2023-2024學(xué)年第二學(xué)期期末試卷
- 上海中僑職業(yè)技術(shù)大學(xué)《中醫(yī)診斷學(xué)實(shí)驗(yàn)》2023-2024學(xué)年第二學(xué)期期末試卷
- 湖南司法警官職業(yè)學(xué)院《機(jī)器視覺系統(tǒng)設(shè)計(jì)與應(yīng)用》2023-2024學(xué)年第二學(xué)期期末試卷
- 2024年醫(yī)學(xué)研究與試驗(yàn)發(fā)展服務(wù)項(xiàng)目資金申請報(bào)告代可行性研究報(bào)告
- 連續(xù)剛構(gòu)橋畢業(yè)設(shè)計(jì)答辯
- 2025新疆西北興業(yè)城投集團(tuán)有限公司崗位招聘(12人)筆試參考題庫附帶答案詳解
- 餐廳供餐協(xié)議書范本
- 期中素養(yǎng)測評(píng)卷(試題)2024-2025學(xué)年五年級(jí)下冊科學(xué)教科版
- 供水公司筆試試題及答案
- 2024年寶雞市城投資產(chǎn)管理有限公司招聘真題
- 上海市華師大二附中2025屆高三第三次測評(píng)英語試卷含解析
- 安徽省糧油經(jīng)貿(mào)有限公司招聘筆試真題2024
- 2025年廣東省廣州市荔灣區(qū)中考一模道德與法治試卷(含答案)
- 2025年上海中考復(fù)習(xí)必背英語考綱詞匯表默寫(漢英互譯)
- 飼料與飼料學(xué)試題及答案
- 2025至2030中國磷石膏市場行情走勢監(jiān)測及未來發(fā)展展望報(bào)告
評(píng)論
0/150
提交評(píng)論