学生成绩管理

来源:互联网 发布:客户数据库管理系统 编辑:程序博客网 时间:2024/04/28 14:53
#include <stdio.h>       double HighScore; /*全局变量,最高分*/       double LowScore; /*全局变量,最低分*/       double SumScore; /*全局变量,总分*/       double AverageScore; /*全局变量,平均分*/       void calcscore(int n)       {           int i;           double j;           SumScore=0;           HighScore=-1;           LowScore=100;           for(i=1;i<=n;i++)           {           scanf("%lf",&j);           if(j>HighScore)           {            HighScore=j;}           if(j<LowScore)           {            LowScore=j;}            SumScore+=j;           }           AverageScore=SumScore/n;       } /*函数声明*/       int main()       {           int n;           scanf("%d",&n);           calcscore(n);           printf("%g %g %g %g\n",HighScore,LowScore,SumScore,AverageScore);           return 0;        }

0 0
原创粉丝点击