学生成绩管理系统V20.docx
《学生成绩管理系统V20.docx》由会员分享,可在线阅读,更多相关《学生成绩管理系统V20.docx(7页珍藏版)》请在冰豆网上搜索。
学生成绩管理系统V20
#include
#include
#include
intmain()
{
inta,b,d,e,n,z;
floatc=0,g;
printf("Inputstudentnumber(n<30):
\n");
scanf("%d",&n);
longv[n],f;
floatvc[n];
next:
;
intx1=0,x2=0,x3=0,x4=0,x5=0,x6=0;
intz1=60,z2=69,z3=70,z4=79,z5=80,z6=89,z7=90,z8=99,z9=100;
printf("ManagementforStudents'scores\n"
"1.Inputrecord\n"
"2.Caculatetotalandaveragescoreofcourse\n"
"3.Sortindescendingorderbyscore\n"
"4.Sortinascendingorderbyscore\n"
"5.Sortinascendingorderbynumber\n"
"6.Searchbynumber\n"
"7.Statisticanalysis\n"
"8.Listrecord\n"
"0.Exit\n"
"PleaseInputyourchoice:
\n");
scanf("%d",&a);
switch(a)
{
case1:
printf("Inputstudent'sIDandscore:
\n");
for(b=0;b{
scanf("%ld%f",&v[b],&vc[b]);
}
break;
case2:
for(b=0;b{
c=c+vc[b];
}
printf("sum=%.0f,aver=%.2f\n",c,c/n);
break;
case3:
printf("Sortindescendingorderbyscore:
\n");
for(d=0;d{
for(e=d+1;e{
if(vc[d]{
g=vc[d];
vc[d]=vc[e];
vc[e]=g;
g=v[d];
v[d]=v[e];
v[e]=g;
}
}
}
for(b=0;b{
printf("%ld\t%.0f\n",v[b],vc[b]);
}
break;
case4:
printf("Sortinascendingorderbyscore:
\n");
for(d=0;d{
for(e=d+1;e{
if(vc[d]>vc[e])
{
g=vc[d];
vc[d]=vc[e];
vc[e]=g;
g=v[d];
v[d]=v[e];
v[e]=g;
}
}
}
for(b=0;b{
printf("%ld\t%.0f\n",v[b],vc[b]);
}
break;
case5:
printf("Sortinascendingorderbynumber:
\n");
for(d=0;d{
for(e=d+1;e{
if(v[d]>v[e])
{
g=vc[d];
vc[d]=vc[e];
vc[e]=g;
g=v[d];
v[d]=v[e];
v[e]=g;
}
}
}
for(b=0;b{
printf("%ld\t%.0f\n",v[b],vc[b]);
}
break;
case6:
printf("Inputthenumberyouwanttosearch:
\n");
scanf("%ld",&f);
z=0;
for(b=0;b{
if(v[b]==f)
{
printf("%ld\t%.0f\n",v[b],vc[b]);
z=1;
break;
}
}
if(z==0)
printf("Notfound!
\n");
break;
case7:
for(b=0;b{
if(vc[b]<60)
x1++;
elseif(vc[b]<70)
x2++;
elseif(vc[b]<80)
x3++;
elseif(vc[b]<90)
x4++;
elseif(vc[b]<100)
x5++;
else
x6++;
}
printf("<60\t%d\t%.2f%%\n",x1,(float)x1/n*100);
printf("%d-%d\t%d\t%.2f%%\n",z1,z2,x2,(float)x2/n*100);
printf("%d-%d\t%d\t%.2f%%\n",z3,z4,x3,(float)x3/n*100);
printf("%d-%d\t%d\t%.2f%%\n",z5,z6,x4,(float)x4/n*100);
printf("%d-%d\t%d\t%.2f%%\n",z7,z8,x5,(float)x5/n*100);
printf("%d\t%d\t%.2f%%\n",z9,x6,(float)x6/n*100);
break;
case8:
for(d=0;d{
for(e=d+1;e{
if(v[d]>v[e])
{
g=vc[d];
vc[d]=vc[e];
vc[e]=g;
g=v[d];
v[d]=v[e];
v[e]=g;
}
}
}
for(b=0;b{
printf("%ld\t%.0f\n",v[b],vc[b]);
}
break;
case0:
printf("Endofprogram!
\n");
gotoend;
default:
printf("Inputerror!
\n");
}
gotonext;
end:
;
}