《C语言程序设计实例教程》课后习题答案

《C语言程序设计实例教程》课后习题答案

ID:43130250

大小:623.91 KB

页数:12页

时间:2019-09-26

《C语言程序设计实例教程》课后习题答案_第1页
《C语言程序设计实例教程》课后习题答案_第2页
《C语言程序设计实例教程》课后习题答案_第3页
《C语言程序设计实例教程》课后习题答案_第4页
《C语言程序设计实例教程》课后习题答案_第5页
资源描述:

《《C语言程序设计实例教程》课后习题答案》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库

1、#include^include#defineSTU_NUM30intMenu(void);voidReadScore(longnum[],floatscore[],intn);voidAverSumofScore(floatscore[],intn);voidSortbyScore(longnum[],floatscore[],intn,int(*compare)(floata,floatb));intAscending(floata,floatb);intDescending(floata,floatb);voi

2、dSwapFloat(float*x,float*y);voidSwapLong(1ong*X,long*y);voidAsSortbyNum(1ongnum[],floatscore[],intn);voidSearchbyNum(longnum[],floatscore[],intn);voidStatistcAnalysis(floatscore[],intn);voidPrintScore(longnum[],floatscore[],intn);intmain(){intitemSelected;intn二0;floatscore[STU.NU

3、M];longnum[STU_NUM];printf("Inputstudentnumber(n<%d):〃,STU_NUM);scanf("%d",&n);while(l){itemSelected=Menu();scanf("%d〃,&itemSe1ected);switch(itemSciccted){case1:ReadScore(num,score,n);break;case2:AverSumofScore(score,n);break;case3:SortbyScore(num,score,n,Descending);printf("So

4、rtindescendingorderbyscore:,z);PrintScore(num,score,n)break;case4:SortbyScore(num,score,n,Ascending);printf("Sortinascendingorderbyscore:,z);PrintScore(num,score,n)break;case5:AsSortbyNum(num,score,n);printf("Sortinascendingorderbynumber:/z);PrintScore(num,score,n)break;cas

5、e6:SearchbyNum(num,score,n);break;case7:StatistcAnalysis(score,n);break;case8:PrintScore(num,score,n);break;case0:printf("Endofprogram!,z);exit(0);default:printf("Inputerror!〃);}}return0;}intMenu(void){printf(,zMarmgementforStudents'scores/z);printf(z/l.Inputrecordz,);print

6、f(〃2・Caculatetotalandaveragescoreofcourse,z);printf(z/3.Sortindescendingorderbyscorez,);printf(,z4.Sortinascendingorderbyscore〃);printf("5.Sortinascendingorderbynumberz,);printf(z,6.Searchbynumber,/);printf("7.Statisticanalysiszz);printf("8.Listrecord,z);printf("0.E

7、xit;printf("'PleaseInputyourchoice:z,);return0;}voidReadScore(longnum[],floatscore[],intn){inti;printf(z/Inputstudent/sIDandscore:,z);for(i=0;i

8、rintf(,zsum=%.Of,aver=%•2f〃,sum,n>0?su

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。