找高手帮忙c语言程序::输入一个班10个学生的学号和每个学生考试三门功课(数学、英语、计算机基础)的成绩

来源:百度知道 编辑:UC知道 时间:2024/06/30 16:12:43
编程计算出每个学生的总分和平均分,并按学生成绩优劣排序,最后打印一张按高分到低分名次排序的成绩单。

分全部给你了~!!!急!

刚学完链表,现学现卖~(自己写的,需要注释再给你填上~)
#include "stdio.h"
#define N 10
struct student{
int number;
int sx;
int yy;
int jsj;
struct *next;
};

void main()
{
struct student *p,*q,*head;
int i=0,j,temp;
int a[N],b[N];
head=NULL;
q=NULL;
while(i<N){
p=(struct student *)malloc(sizeof(struct student));
printf("请输入第%d名同学的学号",i+1);
scanf("%d",&p->number);
printf("请输入第%d名同学的数学成绩",i+1);
scanf("%d",&p->sx);
printf("请输入第%d名同学的英语成绩",i+1);
scanf("%d",&p->yy);
printf("请输入第%d名同学的计算机成绩",i+1);
scanf("%d",&p->jsj);
a[i]=((p->jsj)+(p->sx)+(p->yy));
b[i]=a[i]/3;
if(head==NULL){
head=p;
}
q=p->next;
p=p->next;
i++;
}
for(i=0;i<N;i++)
for(j=0;j<5;j++){