//成绩管理系统v2.0
#include
#include <stdlib.h>
#define N 30
void Input (long num[],int score[],int n);
void Totalave (int score[],int n);
void Scoredes (long num[],int score[],int n,int (*compare)(int a,int b));
int Ascending (int a,int b);
void Numas (long num[],int score[],int n);
void Search (long num[],int score[],int n,int x);
void statistis (long num[],int score[],int n);
void List (long num[],int score[],int n);
int main()
{
int n,score[N],c,x,i;
long num[N];
printf("输入学生人数");
scanf("%d",&n);
printf("1.Input record\n");
printf("2.Caculate totel and average score of course\n");
printf("3.Sort in descending order by score\n");
printf("4.Sort in ascending order by number\n");
printf("5.Search by number\n");
printf("6.Statistic analysis\n");
printf("7.List record\n");
printf("0.Exit\n");
printf("Please enter your choice:\n");
printf("\n");
for(;;)
{
scanf("%d",&c);
switch(c)
{
case 1:
Input (num,score,n);
printf("Please enter your choice:\n");
break;
case 2:
Totalave (score,n);
printf("Please enter your choice:\n");
break;
case 3:
Scoredes (num,score,n,Ascending);
for(i=0;i<n;i++)
printf("ID:%10ld,score:%d\n",num[i],score[i]);//以长整形打印用%ld
printf("Please enter your choice:\n");
break;
case 4:
Numas (num,score,n);
printf("Please enter your choice:\n");
break;
case 5:
printf("请输入查找学号\n");
scanf("%d",&x);
Search (num,score,n,x);
printf("Please enter your choice:\n");
break;
case 6:
statistis (num,score,n);
printf("Please enter your choice:\n");
break;
case 7:
List (num,score,n);
Totalave (score,n);