版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
一種較完善旳學生成績管理系統(tǒng)源代碼分析??!
/*thisisasimplemanagementsystemprogram*/
/*Author:jiguang_duan*/
/*Date:04-04-06*/#include<stdio.h>
#include<conio.h>
#defineN12
#defineN23
floatStu_Score[N1][N2];
floatS_Ave[N1];
floatC_Ave[N2];
intA[N2];/*--------------------functiondeclaration-----------------*/
voidprint_menu();
voidinput_score();/*inputstudents'scores*/
voidprint_s_ave();/*printstudents'averagescore*/
voidstu_ave();/*countstudents'averagescore*/
voidcourse_ave();/*countcourses'averagescore*/
voidprint_c_ave();/*printcourses'averagescore*/
voidfind_max_course();/*searchthemaxscore*/
voidfangcha();/*countthefangcha*//*------------------------main()---------------------------*/
intmain()
{
charch;for(;;){
do{
print_menu();
ch=toupper(getch());
}while(ch!='I'&&ch!='S'&&ch!='C'&&ch!='Q');
switch(ch){
case'I':input_score();
break;
case'S':stu_ave();
print_s_ave();
break;
case'C':course_ave();
print_c_ave();
break;
case'Q':clrscr();
exit(0);
}/*endofswitch*/
}/*endofforstatement*/}/*------------------------input_score()---------------------*/
voidinput_score(void)
{
inti,j;
clrscr();for(i=0;i<N1;i++){
printf("No.%d",i+1);
for(j=0;j<N2;j++)
scanf("%f",&Stu_Score[i][j]);}
}/*-------------------------stu_ave()--------------------------*/
voidstu_ave(void)
{inti,j;for(i=0;i<N1;i++)
S_Ave[i]=0;for(i=0;i<N1;i++){
for(j=0;j<N2;j++)
S_Ave[i]+=Stu_Score[i][j];
S_Ave[i]/=N2;
}
}voidprint_s_ave(void)
{
inti;clrscr();printf("\t\ttheaveragescoretableofallstudents\n");
printf("\t\tNo.\t\tave_score\n");
for(i=0;i<N1;i++)
printf("\t\tNo.%d\t\t%6.2f\n",i,S_Ave[i]);
printf("Pressanykeytoreturntomainmenu....\n");
getch();
}/*--------------------------course_ave()-----------------------*/
voidcourse_ave(void)
{
inti,j;for(i=0;i<N2;i++)
C_Ave[i]=0;for(i=0;i<N2;i++){
for(j=0;j<N1;j++)
C_Ave[i]+=Stu_Score[j][i];
C_Ave[i]/=N1;
}}voidprint_c_ave(void)
{
inti;
char*name[]={"math","chinese","english","physics","chemistry"};clrscr();printf("\t\ttheaveragescoretableofallcourses\n");
printf("\t\tCourseName\t\tave_score\n");
for(i=0;i<N2;i++)
printf("\t\t%s\t\t%6.2f\n",name[i],C_Ave[i]);
printf("Pressanykeytoreturnthemainmenu......\n");
getch();
}/*--------------------------find_max_course()-----------------------*/
voidfind_max_course(void)
{
inti,j,t;
char*name[]={"math","chinese","english","physics","chemistry"};clrscr();
for(i=0;i<N2;i++){
t=0;
for(j=1;j<N1;j++)
if(Stu_Score[t][i]<Stu_Score[j][i])
t=j;
printf("%s\t%d\t%6.2f\n",name[i],t+1,Stu_Score[t][i]);
}}/*---------------------------fangcha()---------------------------*/
voidfangcha(void)
{
floats1=0,s2=0,f;
inti;stu_ave();
for(i=0;i<N1;i++){
s1=s1+S_Ave[i]*S_Ave[i];
s2=s2+S_Ave[i];
}s2/=N1;
f=s1/N1-s2*s2;clrscr();
printf("fangchais%6.2f",f);
}/*-------------------print_menu()--------------------*/
voidprint_menu()
{
clrscr();
textattr(BLUE*16|YELLOW);
gotoxy(15,5);
cprintf("1.(I)nputStudents'score");
textattr(BLUE*16|YELLOW);
gotoxy(15,9);
cprintf("2.(S)tudents'average
溫馨提示
- 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. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 大專會計專業(yè)實習報告(10篇)
- 藥學(士)《專業(yè)知識》練習題與答案
- 2024年新人教版七年級上冊英語教學課件 Unit 7Reading Plus Unit 7
- 2024年新人教版七年級上冊英語教學課件 Starter Unit 3第3課時(Section B 1a-1e)第3課時(Section B 1a-1e)
- 2024年新人教版七年級上冊數(shù)學課件 5.1.1 第2課時 一元一次方程
- 某村二期南區(qū)住宅樓工程施工組織設(shè)計
- 賓川縣2024-2025學年數(shù)學六年級第一學期期末預(yù)測試題含解析
- 平頂山市行政服務(wù)綜合樓二次裝飾工程(標段二:會議廳)施工組織設(shè)計
- 裝備維護與特種車輛駕駛員(中級)復(fù)習測試卷附答案
- 畜牧業(yè)合同中常見的合同內(nèi)容
- 2024年傳送帶行業(yè)分析報告及未來發(fā)展趨勢
- 2024屆上海市普陀區(qū)初三英語一模試卷及答案
- 大學美育(第二版) 課件 第二單元:文學藝術(shù)
- 線性代數(shù)緒論
- 檢驗科的分子組出科小結(jié)
- 視神經(jīng)病治療及護理
- 第三十屆YMO青少年數(shù)學思維研學交流活動四年級復(fù)選試卷(含答案)
- 新概念英語青少版1A-Unit-7課件(共45張)
- 配電箱每周檢查記錄表
- 《食品衛(wèi)生與安全》化肥污染安全案例
- 【高中語文】《大衛(wèi)+科波菲爾(節(jié)選)》教學課件+高二語文+統(tǒng)編版+選擇性必修上冊
評論
0/150
提交評論