• 微信公众号:美女很有趣。 工作之余,放松一下,关注即送10G+美女照片!

scanf_s()函数与数组,运行环境VS2013

开发技术 开发技术 2周前 (07-21) 6次浏览

#include <stdio.h>
#include <windows.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]);
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=%.2fn”,sum,average);
printf(“That’s a handicap of %.0f.n”,average-PAR);
system(“pause”);
return 0;
}


程序员灯塔
转载请注明原文链接:scanf_s()函数与数组,运行环境VS2013
喜欢 (0)