C语言试题请高手来做.高分.

来源:百度知道 编辑:UC知道 时间:2024/06/01 01:28:01
定义一个包含十个元素的整型数组存放十名学生的成绩从键盘数显示最低分,最高分及平均成绩.

已经编译运行通过:

#include<conio.h>
#include<stdio.h>

void main( )
{
int score[10],i=0,max=0,min=0,total=0;
float ave=0.0;

printf( "请输入学生成绩: \n");

for(i=0;i<10;i++)
{
printf("%d: ",i+1);
scanf("%d",&score[i]);

if(i==0)
{
max=min=score[i];
}
else
{
if(max<score[i]) max=score[i];
if(min>score[i]) min=score[i];
}

total += score[i];
}

printf( "\n最高分为: %d\n最低分为: %d\n平均分为: %.1f", max,min,(float)total/10 );

getch();
}

贴了个功能更多的,是我前几天为别人写的一个!应该对于你的要求来说已经绰绰有余了!

#include<iostream.h>
#include<stdio.h>
struct student
{
char name[8];
float sco1;
float sco2;
float sco3;
float sco4;
float sco5;
};
void input(student *stu,int