用VC6写一段程序!求大神速度帮忙
输入十个评委的分数将其存入一维数组,去掉一个最高分,去掉一个最低分,求出其余八人的平均分,最后输出最高分,最低分和平均分...
输入十个评委的分数将其存入一维数组,去掉一个最高分,去掉一个最低分,求出其余八人的平均分,最后输出最高分,最低分和平均分
展开
2个回答
展开全部
我之前用C写过这题
#include <stdio.h>
#include <stdlib.h>
float Score[10];
void GetScores(void)
{
unsigned char i;
printf("Please input ten scores(0~100):\n");
for(i = 0; i < 10; )
{
printf("%d:",i+1);
scanf("%f",&(Score[i]));
if(Score[i] < 0 || Score[i] > 100)
{
printf("The score must be from 0 to 100!\n");
continue;
}
else i++;
}
printf("----------------------------\n");
}
float GetMaxScore(void)
{
unsigned char i;
float max=0;
for(i = 0; i < 10; i++)
{
if(Score[i] > max) max = Score[i];
}
return (max);
}
float GetMinScore(void)
{
unsigned char i;
float min=100;
for(i = 0; i < 10; i++)
{
if(Score[i] < min) min = Score[i];
}
return (min);
}
float GetAvgScore(void)
{
unsigned char i;
float sum,avg;
GetScores();
for(i = 0; i < 10; i++)
{
sum += Score[i];
}
avg = ( sum - GetMaxScore() - GetMinScore() ) / 8;
return avg;
}
int main(int argc, char *argv[])
{
printf("The average score is %.2f\n",GetAvgScore());
system("PAUSE");
return 0;
}
#include <stdio.h>
#include <stdlib.h>
float Score[10];
void GetScores(void)
{
unsigned char i;
printf("Please input ten scores(0~100):\n");
for(i = 0; i < 10; )
{
printf("%d:",i+1);
scanf("%f",&(Score[i]));
if(Score[i] < 0 || Score[i] > 100)
{
printf("The score must be from 0 to 100!\n");
continue;
}
else i++;
}
printf("----------------------------\n");
}
float GetMaxScore(void)
{
unsigned char i;
float max=0;
for(i = 0; i < 10; i++)
{
if(Score[i] > max) max = Score[i];
}
return (max);
}
float GetMinScore(void)
{
unsigned char i;
float min=100;
for(i = 0; i < 10; i++)
{
if(Score[i] < min) min = Score[i];
}
return (min);
}
float GetAvgScore(void)
{
unsigned char i;
float sum,avg;
GetScores();
for(i = 0; i < 10; i++)
{
sum += Score[i];
}
avg = ( sum - GetMaxScore() - GetMinScore() ) / 8;
return avg;
}
int main(int argc, char *argv[])
{
printf("The average score is %.2f\n",GetAvgScore());
system("PAUSE");
return 0;
}
浙江启扬智能科技有限公司
2023-06-12 广告
2023-06-12 广告
Android和ARM、Linux之间存在密切的联系。Android是一种基于Linux内核的嵌入式智能操作系统,它采用了ARM处理器作为其主要处理器架构。Android的内核和许多应用程序都是基于ARM架构编写的,包括处理器和内存管理器。...
点击进入详情页
本回答由浙江启扬智能科技有限公司提供
展开全部
#include <stdio.h>
#include <stdlib.h>
float Score[10];
void GetScores(void)
{
unsigned char i;
printf("Please input ten scores(0~100):\n");
for(i = 0; i < 10; )
{
printf("%d:",i+1);
scanf("%f",&(Score[i]));
if(Score[i] < 0 || Score[i] > 100)
{
printf("The score must be from 0 to 100!\n");
continue;
}
else i++;
}
printf("----------------------------\n");
}
float GetMaxScore(void)
{
unsigned char i;
float max=0;
for(i = 0; i < 10; i++)
{
if(Score[i] > max) max = Score[i];
}
return (max);
}
float GetMinScore(void)
{
unsigned char i;
float min=100;
for(i = 0; i < 10; i++)
{
if(Score[i] < min) min = Score[i];
}
return (min);
}
float GetAvgScore(void)
{
unsigned char i;
float sum,avg;
GetScores();
for(i = 0; i < 10; i++)
{
sum += Score[i];
}
avg = ( sum - GetMaxScore() - GetMinScore() ) / 8;
return avg;
}
int main(int argc, char *argv[])
{
printf("The average score is %.2f\n",GetAvgScore());
system("PAUSE");
return 0;
}
#include <stdlib.h>
float Score[10];
void GetScores(void)
{
unsigned char i;
printf("Please input ten scores(0~100):\n");
for(i = 0; i < 10; )
{
printf("%d:",i+1);
scanf("%f",&(Score[i]));
if(Score[i] < 0 || Score[i] > 100)
{
printf("The score must be from 0 to 100!\n");
continue;
}
else i++;
}
printf("----------------------------\n");
}
float GetMaxScore(void)
{
unsigned char i;
float max=0;
for(i = 0; i < 10; i++)
{
if(Score[i] > max) max = Score[i];
}
return (max);
}
float GetMinScore(void)
{
unsigned char i;
float min=100;
for(i = 0; i < 10; i++)
{
if(Score[i] < min) min = Score[i];
}
return (min);
}
float GetAvgScore(void)
{
unsigned char i;
float sum,avg;
GetScores();
for(i = 0; i < 10; i++)
{
sum += Score[i];
}
avg = ( sum - GetMaxScore() - GetMinScore() ) / 8;
return avg;
}
int main(int argc, char *argv[])
{
printf("The average score is %.2f\n",GetAvgScore());
system("PAUSE");
return 0;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询