输出为何和书上不一样,代码除int main()的参数不一样其他都相同
#include<stdio.h>#define SIZE 10
#define PAR 72
/*没有viod就可以编译通过*/
int main(viod)//错误处及原因: [Error] 'viod' was not declared in this scope
{
int index,score[SIZE];
int sum=0;
float average;
printf("enter %d golf scores:\n",SIZE);
for(index=0;index<SIZE;index++)
scanf("%d",&score[index]);
printf("the scores read in are as follows:\n");
for(index=0;index<SIZE;index++)
printf("%5d",&score[index]);
printf("\n");
for(index=0;index<SIZE;index++)
sum+=score[index];
average=(float) sum/SIZE;
printf("sum of scores=%d,average=%.2f\n",sum,average);
printf("that's a handicap of %.0f.\n",average-PAR);
return 0;
}
[此贴子已经被作者于2016-11-13 01:36编辑过]