这个平均值不对啊
#include<stdio.h>
#define SIZE 10
#define PAR 72
int main(void)
{
int index, score[SIZE];
int sum = 0;
float average;
printf("enter %d golf scores :\n", SIZE);
for (index = 0; index < SIZE; index++)
scanf_s("%d", & score[index]);
printf("the scores read in are as fallows:\n");
for (index = 0; index < SIZE; index++)
printf("%5d",score[index]);
printf("\n");
sum += score[index];
average = (float)sum / SIZE;
printf("sum of average=%.2f scores=%d ", average, score);
printf("that's a handicap of %.02f.\n", average - PAR);
return 0;
}
运行结果
一个警告严重性 代码 说明 项目 文件 行 禁止显示状态
警告 C6273 调用 "printf" 实际类型: "int [10]" 时需要整数时,非整数传递为 Param(3)。 Project3 C:\Users\JIASHIJIE\Desktop\hello word\Project3\Project3\源.cpp 28