C语言 苏小红 第五版 十三章实验题答案(2)
来源:网络收集
时间:2026-07-17
导读:
{if(stu[i].score[j]=90stu[i].score[j]=100) {a++; } if(stu[i].score[j]=80stu[i].score[j]90) {b++; } if(stu[i].score[j]=70stu[i].score[j]80) {c++; } if(stu[i].score[j]=60stu[i].score[j]70) {d++; } if(s
{if(stu[i].score[j]>=90&&stu[i].score[j]<=100)
{a++;
}
if(stu[i].score[j]>=80&&stu[i].score[j]<90)
{b++;
}
if(stu[i].score[j]>=70&&stu[i].score[j]<80)
{c++;
}
if(stu[i].score[j]>=60&&stu[i].score[j]<70)
{d++;
}
if(stu[i].score[j]>=0&&stu[i].score[j]<60)
{e++;
}
rate1=(float)a/n;
rate2=(float)b/n;
rate3=(float)c/n;
rate4=(float)d/n;
rate5=(float)e/n;
}
switch(j)
{
case 0:
printf("MT is:\n");
printf("优秀:%d所占百分比:%f\n",a,rate1);
printf("良好:%d所占百分比:%f\n",b,rate2);
printf("中等:%d所占百分比:%f\n",c,rate3);
printf("及格:%d所占百分比:%f\n",d,rate4);
printf("不及格:%d所占百分比:%f\n",e,rate5);
break;
case 1:
printf("EN is:\n");
printf("优秀:%d所占百分比:%f\n",a,rate1);
printf("良好:%d所占百分比:%f\n",b,rate2);
printf("中等:%d所占百分比:%f\n",c,rate3);
printf("及格:%d所占百分比:%f\n",d,rate4);
printf("不及格:%d所占百分比:%f\n",e,rate5);
break;
case 2:
printf("PH is:\n");
printf("优秀:%d所占百分比:%f\n",a,rate1);
printf("良好:%d所占百分比:%f\n",b,rate2);
printf("中等:%d所占百分比:%f\n",c,rate3);
printf("及格:%d所占百分比:%f\n",d,rate4);
printf("不及格:%d所占百分比:%f\n",e,rate5);
break;
}
}
}
void PrintfScoreNum(STUDENT stu[],int n,float sumcorse[],float avercorse[])
{
int i,j,k;
for(i=0;i<n;i++)
{
printf("%ld",stu[i].studentID);
puts(stu[i].studentName);
printf("the score MT\t EN\t PH\t\n:");
for(j=0;j<3;j++)
{
printf("%d\t",stu[i].score[j]);
}
printf("\n");
}
for(j=0;j<3;j++)
{
for(i=0;i<n;i++)
{
sumcorse[j]=sumcorse[j]+stu[i].score[j];
}
avercorse[j]=sumcorse[j]/n;
}
for(k=0;k<3;k++)
{
printf("the sum and aver is %f %f\n",sumcorse[k],avercorse[k]);
}
}
void Printf(STUDENT stu[],int n)
{
int i,j;
for(i=0;i<n;i++)
{
printf("%ld\n",stu[i].studentID);
puts(stu[i].studentName);
printf("the score MT\t EN\t PH\t\n:");
for(j=0;j<3;j++)
{
printf("%d\t",stu[i].score[j]);
}
printf("\n");
}
}
void WritetoFile(STUDENT stu[],int n)
{
FILE *fp;
int i,j;
if((fp=fopen("student.txt","w"))==NULL)
{
printf("failu
re to open student.txt!\n");
exit(0);
}
for(i=0;i<n;i++)
{fprintf(fp,"%10ld%8s",stu[i].studentID,stu[i].studentName);
for
C语言 苏小红 第五版 十三章实验题答案
(j=0;j<3;j++)
{
fprintf(fp,"%4d",stu[i].score[j]);
}
fprintf(fp,"\n");
}
fclose(fp);
}
int ReadfromFILE(STUDENT stu[])
{
FILE *fp;
int i,j;
if((fp=fopen("student.txt","r"))==NULL)
{
printf("failure to open student.txt!\n");
exit(0);
}
for(i=0;!feof(fp);i++)
{fscanf(fp,"%10ld",&stu[i].studentID);
fscanf(fp,"
%8s",&stu[i].studentName);
for(j=0;j<3;j++)
fscanf(fp,"%4d",&stu[i].score[j]);
}
fclose(fp);
return i-1;
}
C语言 苏小红 第五版 十三章实验题答案(2).doc
将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wenku/127429.html(转载请注明文章来源)
相关推荐:
- [高等教育]一年级家长课程教案
- [高等教育]封丘县人民医院深入推进纠正医药购销领
- [高等教育]2017年6月大学英语四级真题试卷及答案(
- [高等教育]2017年北京第二外国语学院文学院824中
- [高等教育]7 高中历史第7单元1861年俄国农奴制改
- [高等教育]【K12学习】4、实际测量-苏教版六年级
- [高等教育]药具培训试卷题库及部分参考答案
- [高等教育]本土电子元器件目录分销商如何赢得生意
- [高等教育]七年级岭南版美术教案
- [高等教育]书作文之书法活动通讯稿
- [高等教育]Endnote X 软件使用入门和用法总结(LS)
- [高等教育]嵌入式系统的现状及发展状况
- [高等教育]2012抗菌药物专项整治活动方案解读
- [高等教育]人教版新课本一年级数学下册期末试卷
- [高等教育]爱课程民法学观后感
- [高等教育]930机组使用说明书1
- [高等教育]煤气设备设施点检标准
- [高等教育]常见室内观叶植物图解
- [高等教育]312党员群众路线心得体会
- [高等教育]小学信息(苗版)第一册全册教案
高等教育
热门排行
最新推荐
- 在市---局2010党建大会上的讲话
- 《科哲》提纲及补充阅读材料(2010.7)
- 苏州高博软件技术职业学院论文开题报告
- 兼职导游管理的困境及对策探讨
- 基于通用设计理念的现代厨房产品语义研
- 康乐一中2010年至2011年度鼓号队、花束
- 第10章_数据收集整理与描述_期末复习课
- 2008年黑龙江林甸商贸购物中心营销策划
- 水硬度的测定实验报告
- 五分钟教你拍摄夜景光绘照
- 2014年临床妇产科三基三严试题及答案
- 0第二课 纾解压力第一站了解压力
- 解析建筑工程电气设备安装施工技术要点
- 地方性应用型本科高校“双师型”师资队
- 高考语文专题复习课件:小说阅读指导
- 装饰工程投标书2
- 大学生就业难问题探讨及对策
- English and Its History
- 青岛市城市房屋修缮工程质量监督管理办
- 初中英语形容词和副词的用法和练习题




