gymjudge.c
来自「书名:C语言科学与艺术,以前交钱下载的」· C语言 代码 · 共 39 行
C
39 行
/* * File: gymjudge.c * ---------------- * This program averages a set of five gymnastic scores. */#include <stdio.h>#include "genlib.h"#include "simpio.h"/* * Constants * --------- * NJudges -- Number of judges */#define NJudges 5/* Main program */main(){ double gymnasticScores[NJudges]; double total, average; int i; printf("Please enter a score for each judge.\n"); for (i = 0; i < NJudges; i++) { printf("Score for judge #%d: ", i); gymnasticScores[i] = GetReal(); } total = 0; for (i = 0; i < NJudges; i++) { total += gymnasticScores[i]; } average = total / NJudges; printf("The average score is %.2f\n", average);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?