




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、程序設(shè)計報告( 2014 / 2015 學年 第 2 學期)題 目:運動會積分系統(tǒng) 專 業(yè) 組長 學號姓名 組員 學號姓名 指 導(dǎo) 教 師 指 導(dǎo) 單 位 日 期 成員分工組長( ) 組員( ) 組員()評分細則評分項優(yōu)秀良好中等差遵守機房規(guī)章制度上機時的表現(xiàn)學習態(tài)度程序準備情況程序設(shè)計能力團隊合作精神課題功能實現(xiàn)情況算法設(shè)計合理性用戶界面設(shè)計報告書寫認真程度內(nèi)容詳實程度文字表達熟練程度回答問題準確度簡短評語 教師簽名: 年 月 日評分等級查柯丞賈世恩備注評分等級共五種:優(yōu)秀、良好、中等、及格、不及格運動會積分系統(tǒng)一、 課題內(nèi)容和要求學生運動會成績數(shù)據(jù)庫系統(tǒng)記錄某校運動會上全部運動項目,各系獲
2、得的分數(shù)及排名的情況,包括50、100、200,400,1500米,跳高,跳遠,標槍,鉛球鐵餅等。請設(shè)計一個積分系統(tǒng),方便學校對比賽成績進行統(tǒng)計管理。二、 需求分析運動會積分系統(tǒng)的功能框架圖如圖1所示。運動會積分系統(tǒng)錄入模塊按院系編號排序按男團體總分排序按女團體總分排序按院系總分按院系編號查詢院系某個項目情況統(tǒng)計總分按項目編號查詢圖1 功能框架圖 管理員:1)以管理員身份登錄,預(yù)先設(shè)定參加運動會的系院數(shù)目,男子項目數(shù)女子項目數(shù),(每項目取前三名,分別為10,5,2分)2)管理員憑密碼進入錄入成績狀態(tài),填寫比賽結(jié)果,輸入各項目獲獎運動員的信息,但錄入完成后不得修改成績??梢园锤飨翟壕幪栞敵隹偡?;
3、按總分排序;按男團體總分排序 ;按系院編號查詢;按項目編號查詢;按女團體總分排序。3)審核各院系提交的復(fù)核申請,予以批準后修改成績。普通用戶:1)普通用戶可以查詢各個比賽成績,生成團體總分報表,查看參賽院系的成績和各比賽項目最終名次等。2)允許提交復(fù)核申請,提請管理員修改成績。三、概要設(shè)計 1 主要結(jié)構(gòu)體typedef struct node1int school; /*院系編號*/int record; /*項目成績*/struct node1 *next; /*鏈域*/Schools;typedef struct int item; /*項目編號*/Schools *firstschool
4、; /*鏈域指向鏈表中第一個結(jié)點*/ITEM;typedef struct int z; /* 項目總數(shù) */ITEM aMAX;ALLitems;typedef struct node2 int item; /*該院系獲獎的項目*/int record; /*項目成績*/struct node2 *next; /*鏈域*/Items;typedef struct int school; /*院系編號*/int score; /*院系總分*/int boys; /*男團體總分*/int girls; /*女團體總分*/Items *firstitem; /*鏈域指向鏈表中第一個獲獎項目的結(jié)點*
5、/SCHNode;typedef struct int n; /* 院系總數(shù) */SCHNode bMAX;ALLNode;ALLitems *g1;ALLNode *g2;2 主要函數(shù)流程圖開始開始 是否管理員初始化用戶名和密碼NY輸入密碼普通用戶界面登錄N密碼是否正確管理員界面Y進入菜單操作選擇功能結(jié)束N返回菜單圖2登錄函數(shù) 是否結(jié)束Y結(jié)束圖3主函數(shù)流程四、源程序代碼 #include #include #include #include /#include /*屏幕操作函數(shù)*/ #define MAX 50 /#define NULL 0 struct userchar user_Nam
6、e6;char user_Pass6;stu1 = admin, admin ;/初始化用戶名和對應(yīng)密碼void print_Passwd(void)int i = 0;/當前賬號標記int flag1 = 0;/登錄成功標記int flag = 0;/密碼正確標記char p6;/臨時用戶名char s6;/臨時密碼char num = 0;/密碼次數(shù)char temp;/登錄后改密碼printf(請輸入登錄名:n);scanf(%s, p);if (strcmp(stui.user_Name, p) = 0)flag = 1;if (1 = flag)printf(請輸入密碼:n);sca
7、nf(%s, s);elseprintf(沒有此用戶:n);exit(0);while (strcmp(stui.user_Pass, s) != 0)printf(密碼錯誤!n);printf(請重新輸入密碼:n);scanf(%s, s);printf(登錄成功!n);printf(注:你是管理員!n);typedef struct node1int school; /*院系編號*/int record; /*項目成績*/struct node1 *next; /*鏈域*/Schools;typedef struct int item; /*項目編號*/Schools *firstscho
8、ol; /*鏈域指向鏈表中第一個結(jié)點*/ITEM;typedef struct int z; /* 項目總數(shù) */ITEM aMAX;ALLitems;typedef struct node2 int item; /*該院系獲獎的項目*/int record; /*項目成績*/struct node2 *next; /*鏈域*/Items;typedef struct int school; /*院系編號*/int score; /*院系總分*/int boys; /*男團體總分*/int girls; /*女團體總分*/Items *firstitem; /*鏈域指向鏈表中第一個獲獎項目的結(jié)
9、點*/SCHNode;typedef struct int n; /* 院系總數(shù) */SCHNode bMAX;ALLNode;ALLitems *g1;ALLNode *g2;void funct1(ALLitems *g1, ALLNode *g2)Schools *p1;Items *p2;int i = 1, j, k, m, w, h, x;p1 = (Schools *)malloc(sizeof(Schools);p2 = (Items *)malloc(sizeof(Items);if (!p1 | !p2)exit(1);printf(n *輸入各個項目信息 * nn);pr
10、intf( 輸入男子項目總數(shù)m:);scanf(%d, &m);if (m 20)printf( 輸入有誤,m是20以內(nèi)的整數(shù),請重新輸入:);scanf(%d, &m);printf( 輸入女子項目總數(shù)w:);scanf(%d, &w);if (w 20)printf( 輸入有誤,w是20以內(nèi)的整數(shù),請重新輸入:);scanf(%d, &w);printf( 輸入?yún)⒓舆\動會的院系總數(shù)n:);scanf(%d, &g2-n);if (g2-n n20)printf( 輸入有誤,n是20以內(nèi)的整數(shù),請重新輸入:);scanf(%d, &g2-n);g1-z = m + w;printf( 則項目
11、編號為男子1-%d,女子%d-%d, m, m + 1, g1-z);printf(nn *記錄運動會成績*);printf(nn (輸入0標志結(jié)束)n);printf(t項目1:50米、項目2:100米、項目3:200米、項目4:400米、項目5:1500米、n);printf(t項目6:跳高、項目7:跳遠 、項目8:標槍 、項目9:鉛球 、項目10:鐵餅n);for (k = 1; k z; k+)g1-ak.item = k;g1-ak.firstschool = NULL;for (k = 1; k n; k+)g2-bk.school = k;g2-bk.firstitem = 0;
12、g2-bk.score = 0;g2-bk.boys = 0;g2-bk.girls = 0;g2-b0.score = 0;g2-b0.boys = 0;g2-b0.girls = 0;while (i != 0)printf(n 項目:);scanf(%d, &i);if (i != 0)printf( 請輸入前三名:n);h = 3;doprintf( 第%d名:院系(院系編號為數(shù)字), h);scanf(%d, &x);p1 = (Schools *)malloc(sizeof(Schools);p1-school = x;p2 = (Items *)malloc(sizeof(Ite
13、ms);p2-item = i;if (h = 3) p2-record = p1-record = 2;if (h = 2) p2-record = p1-record = 5;if (h = 1) p2-record = p1-record = 10;p1-next = g1-ai.firstschool;g1-ai.firstschool = p1;p2-next = g2-bx.firstitem;g2-bx.firstitem = p2;g2-bx.score = g2-bx.score + p2-record; /* 累計總分 */if (i bx.boys = g2-bx.boy
14、s + p2-record; /* 累計男團體總分 */else g2-bx.girls = g2-bx.girls + p2-record; /* 累計女團體總分 */h-; while (x != 0 & h != 0);void save()FILE *fp1, *fp2;fp1 = (FILE *)malloc(sizeof(FILE);fp2 = (FILE *)malloc(sizeof(FILE);if (fp1 = fopen(sports1, wb) = NULL)printf(cannot open file.n);return;if (fwrite(g1, sizeof(
15、ALLitems), 1, fp1) != 1)printf(file write error.n);fclose(fp1);if (fp2 = fopen(sports2, wb) = NULL)printf(cannot open file.n);return;if (fwrite(g2, sizeof(ALLNode), 1, fp2) != 1)printf(file write error.n);fclose(fp2);void funct2(ALLNode *g2) /* 輸出各院系總分 */int k;printf(nn * 輸出各院系總分 *n);printf( 院系編號t 總
16、分 n);for (k = 1; k n; k+)printf( %dttt %dn, k, g2-bk.score);printf(n);system(pause);printf( 按任意鍵返回主菜單.);getchar();void funct3(ALLNode *g2) /* 按院系編號排序輸出 */int k;Items *p2;p2 = (Items *)malloc(sizeof(Items);printf(nn * 按院系編號排序輸出 *n);printf( 院系編號ttt獲獎情況 n);scanf(%d, &k);for (k = 1; k n; k+)printf(ttt%d
17、t, k);p2 = g2-bk.firstitem;while (p2 != NULL)printf(tt項目%d:得%d分 , p2-item, p2-record);p2 = p2-next;printf(n);printf(n);system(pause);printf(按任意鍵返回主菜單.);getchar();void funct4(ALLNode *g2) /* 按院系總分排序輸出 */int i, j, k;Items *p2;printf(nn * 按院系總分排序輸出 *n);printf( 院系編號tt總分 n);scanf(%d, &k);/printf(輸入要查詢的項目
18、編號:);for (i = 2; i n; i+)printf(%dt, k);p2 = g2-bk.firstitem;while (p2 != NULL)printf(%d tt%dn, g2-bk.school, g2-bk.score);p2 = p2-next;printf(n);g2-b0.score = g2-bi.score;g2-b0.boys = g2-bi.boys;g2-b0.girls = g2-bi.girls;g2-b0.school = g2-bi.school;j = i - 1;while (g2-b0.scorebj.score&j0)g2-bj + 1.
19、score = g2-bj.score;g2-bj + 1.boys = g2-bj.boys;g2-bj + 1.girls = g2-bj.girls;g2-bj + 1.school = g2-bj.school;j-;g2-bj + 1.score = g2-b0.score;g2-bj + 1.boys = g2-b0.boys;g2-bj + 1.girls = g2-b0.girls;g2-bj + 1.school = g2-b0.school;for (k = 1; k n; k+)printf(%d tt%dn, g2-bk.school, g2-bk.score);sys
20、tem(pause);printf(按任意鍵返回主菜單.);getchar();void funct5(ALLNode *g2) /* 按男團體總分排序輸出 */int i, j, k;Items *p2;p2 = (Items *)malloc(sizeof(Items);printf(nn * 按男團體總分排序輸出 *n);printf(院系編號tt男團體總分 n);scanf(%d, &k);/printf(輸入要查詢的院系編號:);for (i = 2; i n; i+)printf(%dt, k);p2 = g2-bk.firstitem;while (p2 != NULL)prin
21、tf(%dtt %dn, g2-bk.school, g2-bk.boys);p2 = p2-next;printf(n);g2-b0.score = g2-bi.score;g2-b0.boys = g2-bi.boys;g2-b0.girls = g2-bi.girls;g2-b0.school = g2-bi.school;j = i - 1;while (g2-b0.boysbj.boys&j0)g2-bj + 1.score = g2-bj.score;g2-bj + 1.boys = g2-bj.boys;g2-bj + 1.girls = g2-bj.girls;g2-bj +
22、1.school = g2-bj.school;j-;g2-bj + 1.score = g2-b0.score;g2-bj + 1.boys = g2-b0.boys;g2-bj + 1.girls = g2-b0.girls;g2-bj + 1.school = g2-b0.school;for (k = 1; k n; k+)printf(%dtt %dn, g2-bk.school, g2-bk.boys);system(pause); / 暫停等待printf(按任意鍵返回主菜單.);getchar();void funct6(ALLNode *g2) /* 按女團體總分排序輸出 *
23、/int i, j, k;Items *p2;p2 = (Items *)malloc(sizeof(Items);printf(nn * 按女團體總分排序輸出 *n);printf(院系編號tt女團體總分 n);scanf(%d, &k);/ printf(輸入要查詢的項目編號:);for (i = 2; i n; i+)printf(%dt, k);p2 = g2-bk.firstitem;while (p2 != NULL)printf(%dtt %dn, g2-bk.school, g2-bk.girls);p2 = p2-next;printf(n);g2-b0.score = g2
24、-bi.score;g2-b0.boys = g2-bi.boys;g2-b0.girls = g2-bi.girls;g2-b0.school = g2-bi.school;j = i - 1;while (g2-b0.girlsbj.girls&j0)g2-bj + 1.score = g2-bj.score;g2-bj + 1.boys = g2-bj.boys;g2-bj + 1.girls = g2-bj.girls;g2-bj + 1.school = g2-bj.school;j-;g2-bj + 1.score = g2-b0.score;g2-bj + 1.boys = g2
25、-b0.boys;g2-bj + 1.girls = g2-b0.girls;g2-bj + 1.school = g2-b0.school;for (k = 1; k n; k+)printf(%dtt %dn, g2-bk.school, g2-bk.girls);system(pause);printf(按任意鍵返回主菜單.);getchar();void funct7(ALLNode *g2) /* 按院系編號查詢院系某個項目情況 */int i, j;Items *p2;printf(n * 按院系編號查詢院系某個項目情況 *n);printf( 輸入要查詢的院系編號:);scanf
26、(%d, &i);printf(t項目1:50米、項目2:100米、項目3:200米、項目4:400米、項目5:1500米、n);printf(t項目6:跳高、項目7:跳遠 、項目8:標槍 、項目9:鉛球 、項目10:鐵餅n);printf( 輸入要查詢的項目編號:);scanf(%d, &j);p2 = g2-bi.firstitem;while (p2 != NULL)if (p2-item = j)printf( 院系編號:%dt項目%d:得%d分n, i, p2-item, p2-record);p2 = p2-next;printf(n);system(pause);printf(
27、按任意鍵返回主菜單.);getchar();void funct8(ALLitems *g1) /* 按項目編號查詢?nèi)〉妹蔚脑合?*/int i;Schools *p1;printf(n* 按項目編號查詢?nèi)〉妹蔚脑合?*n);printf(輸入要查詢的項目編號:);scanf(%d, &i);printf(項目編號ttt取得名次的院系n);printf(%dt, i);p1 = g1-ai.firstschool;while (p1 != NULL)printf( 學校%d:得%d分 , p1-school, p1-record);p1 = p1-next;printf(nn);syste
28、m(pause);printf(按任意鍵返回主菜單.);getchar();void main()int temp;printf(管理員請按1,普通用戶請按2n);scanf(%d, &temp);if (1 = temp)int t;void print_Passwd(void);while (1)print_Passwd();break;g2 = (ALLNode*)malloc(sizeof(ALLNode);g1 = (ALLitems*)malloc(sizeof(ALLitems);if (!g2 | !g1)exit(1);/textcolor(WHITE); /textback
29、ground(BLUE); /clrscr(); system(cls);for (;)printf(tt* * * * * * * * * * * * * * * * * * * * * * *n);printf(tt 運動會分數(shù)統(tǒng)計系統(tǒng) n);printf(tt* * * * * * * * * * * * * * * * * * * * * * *n);printf(tt* 1.輸入各個項目成績并存儲文件 *t n);printf(tt* 2.統(tǒng)計各院系總分 *t n);printf(tt* 3.按院系編號排序輸出 *t n);printf(tt* 4.按院系總分排序輸出 *t n);p
30、rintf(tt* 5.按男團體總分排序輸出 *t n);printf(tt* 6.按女團體總分排序輸出 *t n);printf(tt* 7.按院系編號查詢院系某個項目情況 *t n);printf(tt* 8.按項目編號查詢?nèi)〉妹蔚脑合?*n);printf(tt* 0.退出 *n);printf(tt* * * * * * * * * * * * * * * * * * * * * * *n);printf(tt n);printf(tt n);printf(tt n);printf(tt 請選擇(0-8):);loop1:scanf(%d, &t);system(cls);switc
31、h (t)case 1:funct1(g1, g2); save(); break;case 2:funct2(g2); break;case 3:funct3(g2); break;case 4:funct4(g2); break;case 5:funct5(g2); break;case 6:funct6(g2); break;case 7:funct7(g2); break;case 8:funct8(g1); break;case 0:exit(0);default: printf(輸入有誤,請重新選擇:);goto loop1; /clrscr(); system(cls);else
32、int u;g2 = (ALLNode*)malloc(sizeof(ALLNode);g1 = (ALLitems*)malloc(sizeof(ALLitems);if (!g2 | !g1)exit(1);/textcolor(WHITE); /textbackground(BLUE); /clrscr(); system(cls);for (;)printf(tt* * * * * * * * * * * * * * * * * * * * * * *n);printf(tt 運動會分數(shù)統(tǒng)計系統(tǒng) n);printf(tt* * * * * * * * * * * * * * * * *
33、 * * * * * *n);printf(tt* 1.統(tǒng)計各院系總分 *t n);printf(tt* 2.按院系編號排序輸出 *t n);printf(tt* 3.按院系總分排序輸出 *t n);printf(tt* 4.按院系編號查詢學校某個項目情況 *t n);printf(tt* 5.按項目編號查詢?nèi)〉妹蔚脑合?*n);printf(tt* 0.退出 *n);printf(tt* * * * * * * * * * * * * * * * * * * * * * *n);printf(tt n);printf(tt n);printf(tt n);printf(tt 請選擇(0-5
34、):);loop2:scanf(%d, &u);system(cls);switch (u)case 1:funct2(g2); break;case 2:funct3(g2); break;case 3:funct4(g2); break;case 4:funct7(g2); break;case 5:funct8(g1); break;case 0:exit(0);default: printf(輸入有誤,請重新選擇:);goto loop2; /clrscr(); system(cls);五、測試數(shù)據(jù)及其結(jié)果分析 圖一 登錄界面圖二 管理員界面圖三 普通用戶界面圖四 輸入信息圖五 男團體
35、總分排序圖六 查詢院系某個項目結(jié)果分析(1)進入管理員界面需要正確輸入密碼,普通用戶不需要輸入密碼,但管理員界面的功能更多(2)輸入信息時項目和院系編號必須輸入數(shù)字且不能超過預(yù)先設(shè)定的項目總數(shù)和院系總數(shù)(3)總分排序和團體總分排序要先輸入項目編號,進行查詢和排序時也需要輸入正確的院系編號和項目編號六、調(diào)試過程中的問題此處至少寫5點。(1)運行時出現(xiàn)runtime check failure #2或runtime check failure#3說明有變量越界或有變量沒有初始化,需要擴大變量范圍或給變量賦值(2)調(diào)試時出現(xiàn)亂碼或程序終止則很有可能輸入了錯誤的數(shù)據(jù)類型,需要重啟程序并正確輸入數(shù)據(jù)類型
36、(3)選擇普通用戶后無法顯示菜單界面只有光標但輸入數(shù)字可以選擇功能,問題是system(”cls”)函數(shù)放在了選擇之前導(dǎo)致了清屏(4)結(jié)構(gòu)體定義時缺最后的分號,struct node1 應(yīng)改為struct node1 ;(5)在定義字符串變量時要指定數(shù)據(jù)長度七、課程設(shè)計總結(jié)從經(jīng)驗、個人感悟、建議等方面總結(jié)程序設(shè)計,要求600字以上,語句通順、邏輯清晰,不得從網(wǎng)上拷貝。經(jīng)過一個星期的C語言上機實驗我學到了很多,也對C語言的特點和用法有了進一步的了解和體會,C語言與其他語言相比有著獨有的特點,主要體現(xiàn)在以下幾個方面:1. 簡潔緊湊、靈活方便、2. 運算符豐富、3. 數(shù)據(jù)結(jié)構(gòu)豐富、4.C語法限制不太嚴格、程序設(shè)計自由度大、5.C語言適用范圍大,可
溫馨提示
- 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. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 關(guān)天培小學期末數(shù)學試卷
- 阜陽市2024中考數(shù)學試卷
- 高三零模數(shù)學試卷
- 2025年海南保亭黎族苗族自治縣醫(yī)療集團考核招聘派駐保亭縣看守所駐所醫(yī)師1人(第1號)筆試歷年專業(yè)考點(難、易錯點)附帶答案詳解
- 2025年04月陜西漢中市鐵路中心醫(yī)院招聘崗位0102擬聘人選筆試歷年專業(yè)考點(難、易錯點)附帶答案詳解
- 2025至2030船舶制造產(chǎn)業(yè)深度調(diào)研及前景趨勢與投資報告
- 2025至2030櫥柜行業(yè)市場發(fā)展現(xiàn)狀及并購重組策略與投融資報告
- 2024年廣西職業(yè)技術(shù)學院輔導(dǎo)員考試真題
- 2025至2030超薄CRT彩電行業(yè)發(fā)展分析及前景趨勢與投資報告
- 2025至2030茶袋紙行業(yè)市場深度研究與戰(zhàn)略咨詢分析報告
- s7-1200plc編程及應(yīng)用第三版-廖常初-課后習題答案
- 2020年棗莊市滕州市事業(yè)單位教師招聘考試《教育基礎(chǔ)知識》真題庫及答案解析
- 心源性暈厥課件
- DB41 2556-2023 生活垃圾焚燒大氣污染物排放標準
- 晶體植入術(shù)的術(shù)后護理
- 地黃種植培訓(xùn)課件
- DB11∕T 2000-2022 建筑工程消防施工質(zhì)量驗收規(guī)范
- 勞動通論學習通超星期末考試答案章節(jié)答案2024年
- 《精細化工反應(yīng)安全風險評估規(guī)范》知識培訓(xùn)
- 形勢與政策(一)學習通超星期末考試答案章節(jié)答案2024年
- 2024-2030年中國工業(yè)軟管總成行業(yè)市場發(fā)展趨勢與前景展望戰(zhàn)略分析報告
評論
0/150
提交評論