标题:学生成绩管理系统的编程题,求高手指导
取消只看楼主
红苹果jhwill
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2016-6-7
结帖率:50%
已结贴  问题点数:20 回复次数:2 
学生成绩管理系统的编程题,求高手指导
学生成绩管理系统V2.0
某班有最多不超过30人(具体人数由键盘输入)参加某门课程的考试,编程实现如下菜单驱动的学生成绩管理系统:
(1)录入每个学生的总分和平均分;
(2)计算课程的总分和平均分;
(3)按成绩由高到低排出名次表;
(4)按成绩由低到高排出名次表;
(5)按学号由小到大排出成绩表;
(6)按学号查询学生排名及其考试成绩;
(7)按优秀(90~100)、良好(80~89)、中等(70~79)、及格(60~69)、不及格(0~59)5个类别,统计每个类别的人数以及所占的百分比;
(8)输出每个学生的学号、考试成绩,以及课程总分和平均分。
要求程序运行后先显示如下菜单,并提醒用户输入选项:
1.Input record
2.Caculate total and average score of course
3.Sort in descending order by score
4.Sort in ascending order by score
5.Sort in ascending order by number
6.Search by number
7.Statistic analysis
8.List record
0.Exit
Please enter your choice:
然后根据用户的选项执行相应的操作。
搜索更多相关主题的帖子: 考试成绩 学号查询 管理系统 百分比 成绩表 
2016-06-10 21:20
红苹果jhwill
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2016-6-7
得分:0 
谢谢大家的帮忙
2016-06-18 23:56
红苹果jhwill
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2016-6-7
得分:0 
这是在我同学帮助下写的,大家可以参考一下
#include <stdio.h>
#define N 30
void hanshu1 (float a[],int b[],int n);                                               //输入学号和成绩
void hanshu2 (float a[],int j,float *p1,float *p2);                                   //计算总分和平均分
void hanshu3 (float a[],int n,int b[]);                                                //成绩由高到低排序
void hanshu4 (int a1[],float a2[],int n);                                              //成绩由低到高排序
void hanshu5 (int a1[],float a2[],int n);                                              //学号由低到高排序
int hanshu6 (int a[],float b[],int n,int m);                                           //输入学号查询成绩及其名次
void hanshu7 (float b[],int m,int *a,int *d,int *c,int *e,int *g);                     //统计各个成绩段的人数及百分比
main ()
{
    int a1[N];float a2[N];                                         //a1存放学号、a2存放成绩
    int i,j,n,t,m;                                                 //n存放学生总数、t存放选择菜单项、m存放查询学号
    int a,b,c,d,e;                                                 //该5个变量用于存放优秀、良好等人数
    float total,average;
    printf ("    成绩统计系统v2.0\n\n        选择菜单\n");
    printf ("1.录入每个学生的学号和考试成绩\n2.计算课程的总分和平均分\n3.按成绩由高到低排出名次表\n4.按成绩由低到高排出名次表\n");
    printf ("5.按学号由小到大排出成绩表\n6.按学号查询学生排名及其考试成绩\n7.统计各个成绩段的人数及百分比\n");
    printf ("8.输出每个学生学号、成绩,以及课程总分和平均分\n0.退出\n\n");
    printf ("请输入学生总人数:");
    scanf ("%d",&n);
    do                                                            //控制输入循环,直到用户输入0结束
    {
    printf ("请输入你所需操作的菜单选项前的序号:");
    scanf ("%d",&t);
    switch (t)
    {
        case 1:                                                          //输入学号和成绩
            hanshu1 (a2,a1,n);
            break;
        case 2:                                                         //计算总分和平均分
            hanshu2 (a2,n,&total,&average);
            printf ("总分为:%.1f\n平均分为:%.2f\n",total,average);
            break;
        case 3:                                                           //成绩由高到低排序
            hanshu3 (a2,n,a1);
            printf ("学号        成绩        名次\n");
            for (i=0;i<n;i++)
            {
                printf ("%d          %.1f           %d\n",a1[i],a2[i],i+1);
            }
            break;
        case 4:                                                                   //成绩由低到高排序
            hanshu4 (a1,a2,n);
            printf ("学号        成绩        名次\n");
            for (i=0,j=n;i<n;i++,j--)
            {
                printf ("%d          %.1f          %d\n",a1[i],a2[i],j);
            }
            break;
        case 5:                                                                       //学号由低到高排序
            hanshu5 (a1,a2,n);
            printf ("学号        成绩\n");
            for (i=0;i<n;i++)
            {
                printf ("%d          %.1f\n",a1[i],a2[i]);
            }
            break;
        case 6:                                                                     //输入学号查询成绩及其名次
            printf("请输入需要查询的学号:");
            scanf("%d",&m);
            i=hanshu6 (a1,a2,m,n);
            printf ("名次      成绩\n");
            printf("%d      %.1f\n",i+1,a2[i]);
            break;
        case 7:                                                                      //统计各个成绩段的人数及百分比
            hanshu7 (a2,n,&a,&b,&c,&d,&e);
            printf ("优秀人数为%d,所占百分比为%.2f%%\n良好人数为%d,所占百分比为%.2f%%\n",a,(float)a/n*100,b,(float)b/n*100);
            printf ("中等人数为%d,所占百分比为%.2f%%\n及格人数为%d,所占百分比为%.2f%%\n",c,(float)c/n*100,d,(float)d/n*100);
            printf ("不及格人数为%d,所占百分比为%.2f%%\n",e,(float)e/n*100);
            break;
        case 8:                                                                      //成绩总表(成绩、总分、平均分)
            printf ("学号        成绩\n");
            hanshu2 (a2,n,&total,&average);                                          
            for (i=0;i<n;i++)
            {
                printf ("%d           %.1f\n",a1[i],a2[i]);
            }
            printf ("总分为:%.1f\n平均分为:%.2f\n",total,average);
            break;
        case 0:
            break;
        default:                                                                   //处理输入的非法信息
            printf ("非法输入!\n");
    }   
    }
    while (t!=0);
}

void hanshu1 (float a[],int b[],int n)                                                  //输入学号和成绩
{
    int i;
    printf("请输入学生分数及其学号(用空格隔开):\n");
    for(i=0;i<n;i++)
    {
        scanf("%f %d",&a[i],&b[i]);
    }
}

void hanshu2 (float a[],int j,float *p1,float *p2)                                      //计算总分和平均分
{
    int i;float m=0,n=0;
    for(i=0;i<j;i++)
    {
        m=m+a[i];
    }
    n=(float)m/j;
    *p1=m;
    *p2=n;
}

void hanshu3 (float a[],int n,int b[])                                              //成绩由高到低排序
{
    int i,j,temp1;float temp2;
    for(i=0;i<n;i++)
    {
        for(j=i+1;j<n;j++)
        {
            if(a[i]<a[j])
            {
                temp2=a[i];temp1=b[i];
                a[i]=a[j];b[i]=b[j];
                a[j]=temp2;b[j]=temp1;
            }
        }
    }
}

void hanshu4 (int a1[],float a2[],int n)                                            //成绩由低到高排序
{
    int i,j,m;float t;
    for (i=0;i<n;i++)
    {
        for (j=i+1;j<n;j++)
        {
            if (a2[i]>a2[j])
            {
                t=a2[i];
                a2[i]=a2[j];
                a2[j]=t;
               
                m=a1[i];
                a1[i]=a1[j];
                a1[j]=m;
            }
        }
    }
}

void hanshu5 (int a1[],float a2[],int n)                                       //学号由低到高排序
{
    int i,j,m;float t;
    for (i=0;i<n+1;i++)
    {
        for (j=i+1;j<n;j++)
        {
            if (a1[i]>a1[j])
            {
                t=a2[i];
                a2[i]=a2[j];
                a2[j]=t;
               
                m=a1[i];
                a1[i]=a1[j];
                a1[j]=m;
            }
        }
    }
}

int hanshu6 (int a[],float b[],int n,int m)                                 //输入学号查询成绩及其名次
{   
    hanshu3(b,m,a);                                                        //调用hanshu3,得到成绩由高到低排序
    int i;
    for(i=0;i<m;i++)
    {
        if(n==a[i])
        {
            return (i);
        }
    }
}

void hanshu7 (float b[],int m,int *a,int *d,int *c,int *e,int *g)                        //统计各个成绩段的人数及百分比
{
    int i;
    *a=0;*d=0;*c=0;*e=0;*g=0;
    for(i=0;i<m;i++)
    {
        if(b[i]<=100&&b[i]>=90)
        {
            *a=*a+1;
        }
        if(b[i]<=89&&b[i]>=80)
        {
            *d=*d+1;
        }
        if(b[i]<=79&&b[i]>=70)
        {
            *c=*c+1;
        }
        if(b[i]>=60&&b[i]<=69)
        {
            *e=*e+1;
        }
        if(b[i]>=0&&b[i]<=59)
        {
            *g=*g+1;
        }
    }

2016-06-19 00:02



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-465791-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.362421 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved