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


    #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: ",SIZE);
    for (index = 0; index < SIZE; index++)
    scanf_s("%d",&score[index]);
    for (index = 0; index < SIZE; index++)
    printf("%5d", score[index]);
    printf(" ");
    for (index = 0; index < SIZE; index++)
    sum += score[index];
    average = (float)sum / SIZE;
    printf("Sum of scores=%d,average=%.2f ",sum,average);
    printf("That's a handicap of %.0f. ",average-PAR);
    system("pause");
    return 0;
    }

  • 相关阅读:
    虚函数******
    C++ 中的运算符重载********
    继承
    静态成员和成员函数
    类指针
    内联函数
    k8基础架构
    cobbler自动装机
    ens33-eth0
    PXE-自动装机配置
  • 原文地址:https://www.cnblogs.com/huqi001/p/15039651.html
Copyright © 2020-2023  润新知