用c语言编写函数,统计某班一门课程的总分、平均分,主函数提供人数、成绩

来源:百度知道 编辑:UC知道 时间:2024/05/23 17:09:37
只要一门课程的就可以了,

很简单嘛

#include "stdio.h"
#include "stdlib.h"
#define N 3
struct student
{
char num[6];
char name[10];
int score[3];
float average;
}stu[N];

int main(void)
{
void print(struct student stu[10]);
int i,j;
for(i=0;i<N;i++)
{
printf("input No.: ");
scanf("%s",stu[i].num);
printf("Name: ");
scanf("%s",stu[i].name);
for(j=0;j<3;j++)
{ printf("input score: ");
scanf("%d",&stu[i].score[j]); }
}
print(stu);
system("pause");
return 0;

}

void print(struct student stu[10])
{