写一个统计学生成绩的c语言程序,要求输入10个学生5门功课的成绩,分别用子函数求出:(1)每个学生的平%

来源:百度知道 编辑:UC知道 时间:2024/06/01 02:16:20
c语言 请给出正确答案啊 好的加分!
写一个统计学生成绩的程序,要求输入10个学生5门功课的成绩,分别用子函数求出:(1)每个学生的平均分;(2)每门功课的平均分;(3)找出最高分所对应的学生和功课。

我这有个差不多的,要吗?是我写的实训作业
程序:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int man=0;
int j;
char str[20];
struct student
{
char id[11];
char name[10];
int n1;
int n2;
int n3;
int n4;
int n5;
int n6;
int n7;
int n8;
int n9;
int zong;
int ping;
}student[100],temp;
void read(void)
{
FILE *cj;
int i,k;
man=0;
while(1)
{
printf("请输入要读取的文件:\n");
scanf("%s",&str);
if((cj=fopen(str,"r"))==NULL)
{
printf("打开失败\n");
}
else
{
break;
}
}
for(i=0;i<500;i++)
{
if(fscanf(cj,"%s %s %d %d %d %d %d %d %d %d %d",&student[i].id,&student[i].name,&student[i].n1,&student[i].n2,&student[i].n3,&student[i].n4,&student[i].n5,&student[i].n6,&student[i].n7,&student