| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1549 人关注过本帖
标题:设计一个成绩管理系统
只看楼主 加入收藏
miniq
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2016-11-23
结帖率:75%
收藏
已结贴  问题点数:10 回复次数:3 
设计一个成绩管理系统
设计一个成绩管理系统,要求实现以下功能:
1) 输入功能:输入一个正整数n,再输入n 个学生的姓名、数学、英语和计算机成绩;
2) 从键盘上输入某个学生的姓名,查找是否有该学生的数据,是,输出该学生的姓名数学、英语和计算机成绩;否则,提示查无此人。
3) 输出某门课平均成绩最高的学生的记录(姓名、数学、英语、计算机成绩和平均成绩)。
4) 按平均成绩从高到低输出学生的成绩单(姓名、数学、英语、计算机成绩和平均成绩);
要求:   
1、主程序中用菜单界面接收用户的功能选择;
2、保存学生信息(姓名、数学、英语和计算机成绩)的数组不能定义为全局的,必须定义在main函数中;
3、以上4个功能每个设计成一个函数,其输入参数是保存学生信息的数组的指针和数组大小;
4、如果还没有输入学生基本信息,不允许执行其他功能。
搜索更多相关主题的帖子: 管理系统 计算机 成绩单 正整数 主程序 
2016-12-16 19:54
九转星河
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:长长久久
等 级:贵宾
威 望:52
帖 子:5023
专家分:14003
注 册:2016-10-22
收藏
得分:4 
直接做工程量很大~先自己上论坛找找,有很多雷同你这样的帖子的~我记得就有一个和你几乎一模一样的帖子(但好像没有代码)

[code]/*~个性签名:bug是什么意思?bug是看上去没有可能的东西实际上是有可能做到的 就是这样~2018-08-08更~*/[/code]
2016-12-16 20:04
hxwj
Rank: 2
等 级:论坛游民
帖 子:75
专家分:34
注 册:2016-12-8
收藏
得分:4 
不是没有输入数据,而应该检保存的文件有没有数据,才允许其它操作
2016-12-17 06:08
musicwyr
Rank: 2
等 级:论坛游民
帖 子:3
专家分:14
注 册:2016-12-16
收藏
得分:4 
[u]#include <stdio.h>
#include <malloc.h>
#include <string.h>
#include <stdlib.h>

#define NULL 0
#define ok 1
#define err 0

typedef struct student
{
    char name[15];
    int  mathscore;
    int  englishscore;
    int  pcscore;
    int  totalscore;
}StuInfo;

StuInfo *pStudent;
int stunum;

int inputStuInfo(void)
{
    int i;
    char name[15];
    int  mathscore;
    int  englishscore;
    int  pcscore;
    printf("please input the students num\n");
    scanf("%d",&stunum);
    pStudent=(StuInfo *)calloc(stunum,sizeof(StuInfo));
    if(pStudent==NULL)
    {
        printf("get memory err!\n");
        return err;
    }

    for(i = 0;i < stunum;i++)
    {
        printf("please input student name\n");
        scanf("%s",name);
        strcpy(pStudent[i].name,name);

        printf("please input student mathscore\n");
        scanf("%d",&mathscore);
        pStudent[i].mathscore = mathscore;

        printf("please input student englishscore\n");
        scanf("%d",&englishscore);
        pStudent[i].englishscore = englishscore;

        printf("please input student pcscore\n");
        scanf("%d",&pcscore);
        pStudent[i].pcscore = pcscore;

        pStudent[i].totalscore = mathscore + englishscore + pcscore;

    }

    printf("student information input over!\n");
    return ok;
}

void findStuInfo(void)
{
    char name[15];
    int i;
    printf("please input students name!");
    scanf("%s",name);
    for(i = 0;i < stunum;i++)
    {
        if(strcmp(pStudent[i].name,name)==0)
        {
            printf("this students mathscore is %d\n",pStudent[i].mathscore);
            printf("this students englishscore is %d\n",pStudent[i].englishscore);
            printf("this students pcscore is %d\n",pStudent[i].pcscore);
            break;
        }

    }

    if(i == stunum)
    {
        printf("can not find this student");
    }

}

void findHighStu(void)
{
    int major;
    int i;
    int maxvalue;
    printf("do you want to find which major?\n");
    printf("1:mathscore!\n");
    printf("2:englishscore!\n");
    printf("3:pcscore!\n");
    printf("please input the major code\n");
    scanf("%d",&major);
    maxvalue = 0;
    for(i = 0;i < stunum;i++)
    {
        if(major==1)
        {
            if(pStudent[i].mathscore > pStudent[maxvalue].mathscore )
            {
                maxvalue = i;
            }
        }
        else if(major==2)
        {
            if(pStudent[i].englishscore > pStudent[maxvalue].englishscore )
            {
                maxvalue = i;
            }
        }
        else if (major==3)
        {
            if(pStudent[i].pcscore > pStudent[maxvalue].pcscore )
            {
                maxvalue = i;
            }
        }
        else
        {
            printf("major code is not right\n");
        }

    }

    int aver;

    aver = (pStudent[maxvalue].mathscore+ pStudent[maxvalue].englishscore+ pStudent[maxvalue].pcscore)/3;

    printf("this students name is %s\n",pStudent[maxvalue].name);
    printf("this students mathscore is %d\n",pStudent[maxvalue].mathscore);
    printf("this students englishscore is %d\n",pStudent[maxvalue].englishscore);
    printf("this students pcscore is %d\n",pStudent[maxvalue].pcscore);
    printf("this students averscore is %d\n",aver);

}

void recordStuScore(void)
{
    int i,j;
    StuInfo t;

    for(i = 0;i < stunum;i++)
    {
        for(j=i+1;j<stunum;j++)
        {
            if(pStudent[i].totalscore<pStudent[j].totalscore)
            {
                t=pStudent[i];
                pStudent[i]=pStudent[j];
                pStudent[j]=t;
            }
        }
    }

    for(i = 0;i < stunum;i++)
    {
        printf("num %d :",i+1);
        printf("name is %s,",pStudent[i].name);
        printf("mathscore is %d,",pStudent[i].mathscore);
        printf("englishscore is %d,",pStudent[i].englishscore);
        printf("pcscore is %d,",pStudent[i].pcscore);
        printf("ave is %d\n",pStudent[i].totalscore/3);
    }


}

void dispMenu(void)
{
    printf("*********************************************************************\n");
    printf("welcome to score manage system\n");
    printf("*********************************************************************\n");
    printf("1: input students information\n");
    printf("2: find students information\n");
    printf("3: find the students who have the highest score in which major \n");
    printf("4: record students information from high to low \n");
    printf("*********************************************************************\n");
}

int main(void)
{
    int opercode;
    static char okflag=0;
    dispMenu();
    printf("please input the operator code!\n");
    while(1)
    {

        scanf("%d",&opercode);

        switch(opercode)
        {
            case 1 : inputStuInfo();
                      okflag=1;
                      opercode= -1;
                      dispMenu();
                      break;

            case 2 : if(okflag == 1)
                      {
                          findStuInfo();
                          opercode= -1;
                          dispMenu();
                      }

                      break;

            case 3 : if(okflag == 1)
                     {
                         findHighStu();
                         opercode= -1;
                         dispMenu();
                     }

                     break;

            case 4 : if(okflag == 1)
                      {
                          recordStuScore();
                          opercode= -1;
                          dispMenu();
                      }

                     break;

            default: break;
        }

    }

}
2016-12-19 21:55
快速回复:设计一个成绩管理系统
数据加载中...
 
   



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

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