您的位置:首页 > 其它

学生成绩管理

2016-11-30 09:30 120 查看
#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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: