学生成绩管理系统V2.0

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

#include

#include

#include

int main()

{

int a,b,d,e,n,z;

float c=0,g;

printf("Input student number(n<30):\n");

scanf("%d",&n);

long v[n],f;

float vc[n];

next:;

int x1=0,x2=0,x3=0,x4=0,x5=0,x6=0;

int z1=60,z2=69,z3=70,z4=79,z5=80,z6=89,z7=90,z8=99,z9=100;

printf("Management for Students' scores\n"

"1.Input record\n"

"2.Caculate total and average score of course\n"

"3.Sort in descending order by score\n"

"4.Sort in ascending order by score\n"

"5.Sort in ascending order by number\n"

"6.Search by number\n"

"7.Statistic analysis\n"

"8.List record\n"

"0.Exit\n"

"Please Input your choice:\n");

scanf("%d",&a);

switch (a)

{

case 1:

printf("Input student's ID and score:\n");

for (b=0;b

{

scanf("%ld%f",&v[b],&vc[b]);

}

break;

case 2:

for (b=0;b

{

c=c+vc[b];

}

printf("sum=%.0f,aver=%.2f\n",c,c/n);

break;

case 3:

printf("Sort in descending order by score:\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;

case 4:

printf("Sort in ascending order by score:\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;

case 5:

printf("Sort in ascending order by number:\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;

case 6:

printf("Input the number you want to search:\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("Not found!\n");

break;

case 7:

for (b=0;b

{

if (vc[b]<60)

x1++;

else if (vc[b]<70)

x2++;

else if (vc[b]<80)

相关文档
最新文档