C语言编程题目!急.明天就要用!!!!!!!!!!!!!!!!

来源:百度知道 编辑:UC知道 时间:2024/06/17 20:35:29
编写一个有20个学生的班级的成绩管理程序!
要求:
1.使用键盘输入:各学生的学号,姓名,性别,语文,数学,物理,化学,英语,的成绩!
2.并且计算出各学生的总成绩!平均成绩!
3.可以按照单科成绩或总成绩进行排序!
还可以根据学号进行成绩查询!
DOS系统下运行!!!!
只要完整的代码!!!!!!!!!!
在线等待中............................

刚写的,代码如下:
#include<stdio.h>
#include<string.h>
#define N 20
struct stu
{
long num;
char name[20];
char sex;
float score[7];
} a[N];

void input(int p)
{
long tmpn;
char tmpc,tmps[20];
float tmp;
int i,j;
scanf("%ld",&tmpn);
a[p].num=tmpn;
scanf("%c",&tmpc);
j=0;
do
{
scanf("%c",&tmpc);
if (tmpc!=' ')
{
tmps[j]=tmpc;
tmps[j+1]='\0';
j++;
}
}
while (tmpc!=' ');
strcpy(a[p].name,tmps);
scanf("%c",&tmpc);
a[p].sex=tmpc;
a[p].score[5]=0;
for (i=0;i<5;i++)
{
scanf("%f",&tmp);
a[p].score[i]=tmp;
a[p].score[5]+=tmp;
}
a[p].score[6]=a[p].score[5]/5;
}
void swap(p)
{
int i;
long tmpn;<