C语言设计学生成绩管理系统V1.0。。。急求啊。。高手帮帮忙啦~~先谢谢咯~~O(∩_∩)O哈哈~

某班有最多不超过30人(具体人数由键盘输入)参加某门课程的考试,用一维数组作函数参数编程实现如下学生成绩管理:
(1) 录入每个学生的学号和考试成绩;
(2) 计算课程的总分和平均分;
(3) 按成绩由高到低排出名次表;
(4) 按学号由小到大排出成绩表;
(5) 按学号查询学生排名及其考试成绩;
(6) 按优秀(90~100)、良好(80~89)、中等(70~79)、及格(60~69)、不及格(0~59)5个类别,统计每个类别的人数及其所占的百分比;
(7) 输出每个学生的学号、考试成绩,课程总分和平均分。

第1个回答  2011-05-10
#include <stdio.h>
#define ARR_SIZE 30

void sort(float score[],long num[],int n);
void SS(float score[],long num[],int n);
int Sea(long num[],int n,long x);

int main()
{
float a=0,b=0,c=0,d=0,e=0,score[ARR_SIZE];
int n,pos,i,temp,totalscore=0,averagescore;
long num[ARR_SIZE],x;
printf("Please input total number:\n");
scanf("%d",&n);

printf("Please enter the number and score:\n");
for(i=0;i<n;i++)
{
scanf("%ld,%f",&num[i],&score[i]);
}

for(i=0;i<n;i++)
{
totalscore=totalscore+score[i];
}

printf("The total score is: %d\nThe average score is: %d\n",totalscore,totalscore/n);

printf("Sorted result as score decreasing:\n");
sort(score,num,n);

for(i=0;i<n;i++)
{
printf("%ld,%4.0f\n",num[i],score[i]);
}

SS(score,num,n);
printf("Sorted result as number increasing:\n");
for(i=0;i<n;i++)
{
printf("%ld,%4.0f\n",num[i],score[i]);
}

printf("Please input the number you want to search:\n");
scanf("%ld",&x);
pos = Sea(num,n,x);
if( pos!= -1)
{
printf("The ranking of number %ld is %d, and the score is %4.0f\n",x,pos+2,score[pos]);
}
else
{
printf("The number you input is not exist!\n");
}

printf("perfect\t\tgood\t\tmedium\t\tpass\t\tfail\n");

for(i=0;i<n;i++)
{

if(score[i]>=90)
{
a++;
}
else if(score[i]>=80)
{
b++;
}
else if(score[i]>=70)
{
c++;
}
else if(score[i]>=60)
{
d++;
}
else
{
e++;
}
}
printf("%.0f\t\t%.0f\t\t%.0f\t\t%.0f\t\t%.0f\n",a,b,c,d,e);
printf("%.2f%%\t\t%.2f%%\t\t%.2f%%\t\t%.2f%%\t\t%.2f%%\n",(100*a)/n,(100*b)/n,(100*c)/n,(100*d)/n,(100*e)/n);

printf("All the numbers and scores are below:\n");

sort(score,num,n);

for(i=0;i<n;i++)
{
printf("%ld,%4.0f\n",num[i],score[i]);
}

printf("The total score is: %d\nThe average score is: %d\n",totalscore,totalscore/n);

return 0;
}

void sort(float score[],long num[],int n)
{
int i,j;
float temp1;
long temp2;
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
if(score[j]>score[i])
{
temp1=score[j];
score[j]=score[i];
score[i]=temp1;

temp2=num[j];
num[j]=num[i];
num[i]=temp2;
}
}
}
}
void SS(float score[],long num[],int n)
{
int i,j;
float temp1,temp2;
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
if(num[i]>num[j])
{
temp1=score[j];
score[j]=score[i];
score[i]=temp1;

temp2=num[j];
num[j]=num[i];
num[i]=temp2;
}
}
}
}

int Sea(long num[],int n,long x)
{
int i;

for(i=0;i<n;i++)
{
if(num[i]==x)
return (i);
}
return (-1);
}本回答被提问者采纳
相似回答