解题思路:
注意事项:
参考代码:
#include<stdio.h>
struct student
{
float score[7];
char name[50];
};
int main()
{
struct student x;
while (scanf("%f",&x.score[0])!=EOF)
{
scanf("%f %f %f %f %f %f", &x.score[1], &x.score[2], &x.score[3], &x.score[4], &x.score[5], &x.score[6]);
scanf("%s", x.name);
int i,max_sign = 0, min_sign = 0;
float aver=0,max=x.score[0],min=x.score[0];
for (i = 1; i < 7; i++)
{
if (max < x.score[i])
{
max_sign = i;
max = x.score[i];
}
if (min > x.score[i])
{
min_sign = i;
min = x.score[i];
}
}
if (min_sign != max_sign)
{
x.score[max_sign] = 0;
x.score[min_sign] = 0;
}
else
{
x.score[0] = 0;
x.score[1] = 0;
}
for (i = 0; i < 7; i++)
{
if (x.score[i] != 0)
{
aver += x.score[i];
}
}
aver /= 5.0;
printf("%s %.2f\n", x.name, aver);
}
return 0;
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题6.1 (C语言代码)浏览:700 |
C语言训练-求s=a+aa+aaa+aaaa+aa...a的值 (C语言代码)浏览:760 |
WU-C语言程序设计教程(第三版)课后习题11.12 (C++代码)(想学链表的小伙伴可以看看)浏览:964 |
C语言程序设计教程(第三版)课后习题7.1 (C语言代码)浏览:642 |
DNA (C语言描述,蓝桥杯)浏览:1653 |
回文数字 (C语言代码)浏览:2539 |
蚂蚁感冒 (C语言代码)浏览:816 |
钟神赛车 (C语言代码)浏览:665 |
1197求助浏览:667 |
A+B for Input-Output Practice (I) (C语言代码)浏览:451 |