求值的加权平均数;发生错误,错误见附图
#include <stdio.h>#include <stdlib.h>
void main()
{
int i=1,j;
float score[5],radio[4]={0.1,0.2,0.3,0.4};
char key=' ';
while(key==' ')//按其他键盘则退出
{
printf("please input the %d student",i++);
printf(" the score:");
for(j=0;j<4;j++)
{
scanf("%f",&score[j]);//输入4个值
score[4]+=score[j]*radio[j];//将其加权后的值赋值给score【4】中
}
printf("the average score is %.2f\n",score[4]);//输出secore【4】的值
printf("please press the space continue or other exit");
key=getchar();
}
}