| 网站首页 | 业界新闻 | 群组 | 人才 | 下载频道 | 博客 | 代码贴 | 编程论坛
 雷速体育发帖软件开发QQ118000023 C语言培训|一对一辅导|零基础学编程 LightningChart 快速先进的.Net图表控件

已结贴   问题点数：20  回复次数：6

a）裁判人数必须在4人到8人之间
b）每个裁判可以给出一个从0.0到10.0的标记（一个可能包含分数的实数）
#include <stdio.h>

int main() {

int numOfJudges;

printf("Diving Competition\n\n");
printf("Enter Number of Judges (4 to 8): ");
scanf("%d", &numOfJudges);
printf("\n");

if(numOfJudges >= 4 && numOfJudges <= 8) {
float num[numOfJudges];
float max, min, final = 0.0;
min = num[0];
max = num[numOfJudges];

for(int i = 0; i < numOfJudges; i++) {
printf("Judge %d score: ", i+1);
scanf("%f", &num[i]);
if(num[i] >= 0.0 && num[i] <= 10.0) {
if(num[i] < min) {
min = num[i];
}
if(num[i] > max) {
max = num[i];
}
final += num[i];
} else {
printf("Judges can only award a mark from 0.0 to 10.0, exit and try again");
return 1;
}
}
final = final - min;
printf("\nMin: %.1f, Max: %.1f, Final Result: %.1f", min, max, final/(numOfJudges-1));
} else {
printf("Please exit and enter the correct number of judges between 4 to 8");
return 1;
}
}
得分:10

得分:0

得分:0

#include <stdio.h>

int main( void )
{
int n;
if( scanf("%d",&n)!=1 || n<4 || n>8 )
{
puts( "......" );
return 1;
}

for( int i=0; i!=n; ++i )
{
{
puts( "......" );
return 1;
}

}

}

得分:0
min = num[0];
max = num[numOfJudges];

得分:0

得分:10

• 7
• 1/1页
• 1