status printStuInfoheader (int subNum, int inclRanking) {
int i;
puts ("--------------------------------------------------------------------------");
printf ("%-4s%2c","id",32);
printf ("%-4s%2c","学号",32);
printf ("%-10s%2c","姓名",32);
for (i=0; isubNum; i++)
printf ("%-6s%2c",subject[i],32);
putchar ('\n');
puts ("--------------------------------------------------------------------------");
}
/*输出单个学生信息*/
status printStuInfo (student stu[], int stuIndex, int subNum, int inclRanking) {
int i;
printf ("%-4d%2c",stu[stuIndex].id,32); /*id*/
printf ("%-4d%2c",stu[stuIndex].no,32); /*学号*/
printf ("%-10s%2c",stu[stuIndex].name,32);/*姓名*/
for (i=0; isubNum; i++) /*各门课成绩分数*/
printf ("%-6.2f%2c",stu[stuIndex].scores[i].score,32);
putchar ('\n');
return 1;
}
/*输出全部学生信息*/
status printAllStuInfo (student stu[], int stuNum, int subNum, int inclRanking) {
int i;
/*学生信息为空则提示并退出*/
if (stuInfoEmpty (stu,stuNum)) {
stuInfoEmptyOp(stu,stuNum);
return 0;
}
puts ("==========================================================================");
puts ("全部学生信息");
puts ("==========================================================================");
putchar ('\n');
printf ("%d名学生信息如下 ↓↓\n",stuNum);
putchar ('\n');
/*输出信息之表头*/
printStuInfoheader (subNum, inclRanking);
/*输出信息*/
for (i=0; istuNum; i++)
printStuInfo (stu, i, subNum, inclRanking);
puts ("--------------------------------------------------------------------------");
putchar ('\n');
puts ("学生信息输出完毕!即将返回主菜单 。");
putchar ('\n');
pressAnykeyToContinue ();
return 1;
}
/*输出统计数据*/
status printStatistics (student stu[], int stuNum, int subNum) {
int sub1PassCount,sub2PassCount,sub3PassCount,sub4PassCount; /*各科及格人数*/
float sub1PassRate,sub2PassRate,sub3PassRate,sub4PassRate; /*各科及格率*/
int i;
/*学生信息为空则提示并退出*/
if (stuInfoEmpty (stu,stuNum)) {
stuInfoEmptyOp(stu,stuNum);
return 0;
}
system ("cls");
puts ("==========================================================================");
puts ("输出统计数据");
puts ("==========================================================================");
putchar ('\n');
printf ("全部%d名学生\n",stuNum);
putchar ('\n');
sub1PassCount = sub2PassCount = sub3PassCount = sub4PassCount = 0;
for (i=0; istuNum; i++) {
if (stu[i].scores[0].score=PASSstu[i].scores[0].score=100)
sub1PassCount++;
if (stu[i].scores[1].score=PASSstu[i].scores[1].score=100)
sub2PassCount++;
if (stu[i].scores[2].score=PASSstu[i].scores[2].score=100)
sub3PassCount++;
if (stu[i].scores[3].score=PASSstu[i].scores[3].score=100)
sub4PassCount++;
}
sub1PassRate = (float)sub1PassCount / (float)stuNum;
sub2PassRate = (float)sub2PassCount / (float)stuNum;
sub3PassRate = (float)sub3PassCount / (float)stuNum;
sub4PassRate = (float)sub4PassCount / (float)stuNum;
puts ("各门课及格率如下:");
puts ("--------------------------------------------------------------------------");
printf ("%-6s%2c%-8s%2c%-6s\n",subject[0],32,"及格人数",32,"及格率");
puts ("--------------------------------------------------------------------------");
printf ("%-6s%2c%-8d%2c%-5.2f%c",subject[0],32,sub1PassCount,32,sub1PassRate*100,'%');
putchar ('\n');
printf ("%-6s%2c%-8d%2c%-5.2f%c",subject[1],32,sub2PassCount,32,sub2PassRate*100,'%');
推荐阅读
- 小县城直播运营,县城直播运营工资
- js给dom元素添加css,js给div添加css样式
- vb.net百度云 vb下载百度云
- css边框boxshaw,Css边框虚线怎么设置
- html5打开页面弹出键盘,html打开页面弹出一个窗口
- 矩阵转置vb.net代码 矩阵转置程序代码
- 怎么用python提取fasta序列,python提取数据
- 微信视频号怎样拉黑对方,微信视频号怎么拉黑一个人
- 怎么将微信直播视频下载,如何将微信直播视频下载下来