| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 467 人关注过本帖
标题:求此成绩管理题的编程
只看楼主 加入收藏
songxianhui
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2010-4-10
结帖率:100%
收藏
已结贴  问题点数:10 回复次数:3 
求此成绩管理题的编程
用VC++可视化开发平台实现一个本班成绩管理与统计程序,要求界面友好,简洁大方,方便使用。程序的功能要求如下:

(1)    支持对话框形式的学生信息与课程成绩的录入、修改和删除;

(2)    计算本班每一位同学的学分成绩GPA( grade point average) 并排名,以此作为奖学金评定的参考依据;

(3)    对某一门课程,按照优(90-100)/良(80-89)/中(70-79)/及格(60-69)/不及格(60分以下)五档进行划分,统计在每一档的学 生人数和百分比例,并画出相应的饼图或直方图。

(4)    支持以文本格式导出学生的成绩记录,支持从文件中导入学生成绩记录;

(5)    其他成绩管理与统计所需的功能,可按自己的预想进行扩展。

(6)    演示时的模拟数据不少于15人;
搜索更多相关主题的帖子: 管理 
2010-04-11 09:49
寒风中的细雨
Rank: 17Rank: 17Rank: 17Rank: 17Rank: 17
等 级:贵宾
威 望:66
帖 子:1710
专家分:8645
注 册:2009-9-15
收藏
得分:10 
程序还有待改进  有空在该下 发过去看看
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>

#define  LEN  sizeof( struct LNode )

struct Subject
{
    int credit;//学分
    int mark;//单科成绩分
};

typedef struct LNode
{
    char name[12];
    int number;
    struct Subject chinese;
    struct Subject english;
    struct Subject maths;
    struct LNode *next;
}*Student;

FILE *fp = NULL;
Student L = NULL;

 void Creat_File();//读取或建立文件信息操作
void Save_File();//保存信息至文件
 void Init();//初始化链表
void Insert();//添加学生信息
void Delete();//删除学生信息
void Output();//输出全部信息
void Change();//修改学生信息
void Credit_Ranking();//按学分平均排名从高到低排
 float Count_Credit( Student p );//计算同学的评价学分成绩
void Mark_Ranking();//按总分进行排名 从高到低
 int Count_Mark( Student p );//计算每位同学的总分
void Lesson_Analysis();//选择一门课程进行分析 并画出直方图

int main()
{
    Init();
    Creat_File();
   
    while(1)
    {
        int i;
        printf("\n请按照下面提示进行相应的操作!\n");
        printf("*按'1'进行添加学生信息*\n");
        printf("*按'2'进行删除学生信息*\n");
        printf("*按'3'输出全部学生信息*\n");
        printf("*按'4'进行修改学生信息*\n");
        printf("*按'5'按平均学分成绩从高到低排名*\n");
        printf("*按'6'按总分进行从高到低排名*\n");
        printf("*按'7'选择学科进行成绩分析*\n");
        printf("*按'8'进行信息保存*\n");
        printf("*按'9'推出系统*\n");
        scanf("%d", &i );

        switch( i )
        {
        case 1:
            Insert();
            break;
        case 2:
            Delete();
            break;
        case 3:
            Output();
            break;
        case 4:
            Change();
            break;
        case 5:
            Credit_Ranking();
            break;
        case 6:
            Mark_Ranking();
            break;
        case 7:
            Lesson_Analysis();
            break;
        case 8:
            Save_File();
            break;
        case 9:
            exit(0);
            break;
        }
    }
    return 0;
}
//读取或建立文件信息操作
void Creat_File()
{
    Student p;
    if( !(fp=fopen("d:\\studentmg.text", "r")) )
    {
        //fp=fopen("d:\\studentmg.text", "w");
        return;
    }
    else
    {
        while( !feof(fp) )
        {
            p = (Student) malloc (LEN);
            fread( p, LEN, 1, fp );   
            p->next = L->next;
            L->next = p;
        }
    }
    fclose( fp );
}
//保存信息至文件
void Save_File()
{
    Student p = L->next;
    fp = fopen("d:\\studentmg.text", "w");
    while( p )
    {
        fwrite( p, LEN, 1, fp );
        p = p->next;
    }
    fclose( fp );
}

//初始化链表
void Init()
{
    L = (Student) malloc (LEN);
    if( !L )
        exit(0);
    L->next = NULL;
}
//添加学生信息
void Insert()
{
    Student p;
    int amount;

    printf("输入要添加学生信息的人数:");
    scanf("%d", &amount );

    while( amount-- )
    {
        p = (Student) malloc (LEN);
        printf("输入学生姓名:");
        scanf("%s", p->name );
        printf("输入学生的学号:");
        scanf("%d", &p->number );
        printf("分别输入语文学分和成绩:");
        scanf("%d%d", &p->chinese.credit, &p->chinese.mark );
        printf("分别输入英语学分和成绩:");
        scanf("%d%d", &p->english.credit, &p->english.mark );
        printf("分别输入数学学分和成绩:");
        scanf("%d%d", &p->maths.credit, &p->maths.mark );
        
        p->next = L->next;
        L->next = p;
    }
}
//删除学生信息
void Delete()
{
    Student p = L->next, f = L;
    int num;

    if( !p )
    {
        printf("系统中没有存储学生信息!");
        return;
    }
    printf("输入要删除学生的学号:");
    scanf("%d", &num );
    while( p && (p->number!=num) )
    {
        f = f->next;
        p = p->next;
    }
    if( !p )
        printf("没有查到该学生的信息!");
    else
        f->next = p->next;
    free( p );
    printf("删除成功!\n");
}
//输出全部信息
void Output()
{
    Student p = L->next;
    if( !p )
    {
        printf("系统中没有存储学生信息!");
        return;
    }
    while( p != NULL )
    {
        printf("学生姓名:%s\n", p->name );
        printf("学生的学号:%d\n", p->number );
        printf("语文学分和成绩:%d %d\n", p->chinese.credit, p->chinese.mark );
        printf("英语学分和成绩:%d %d\n", p->english.credit, p->english.mark );
        printf("数学学分和成绩:%d %d\n", p->maths.credit, p->maths.mark );

        p = p->next;
    }
    free(p);
}   
//修改学生信息
void Change()
{
    Student p = L->next;
    int num;

    if( !p )
    {
        printf("系统中没有存储学生信息!");
        return;
    }
    printf("输入你要查找学生的学号:");
    scanf("%d", &num );

    while( p && (p->number!=num) )
        p = p->next;
    if( !p )
        printf("没有查到该学生的信息!");
    else
    {
        printf("输入修改学生姓名为:");
        scanf("%s", p->name );
        printf("输入修改学生的学号为:");
        scanf("%d", &p->number );
        printf("分别输入修改语文学分和成绩为:");
        scanf("%d%d", &p->chinese.credit, &p->chinese.mark );
        printf("分别输入修改英语学分和成绩为:");
        scanf("%d%d", &p->english.credit, &p->english.mark );
        printf("分别输入修改数学学分和成绩为:");
        scanf("%d%d", &p->maths.credit, &p->maths.mark );
    }
}

//按学分平均排名从高到低排
void Credit_Ranking()
{
    Student p = L->next, pf = p->next;
    void Exchang( Student &p1, Student &p2 );

    if( !p )
    {
        printf("系统中没有存储学生信息!");
        return;
    }
    while( p )
    {
        pf = p->next;
        while( fp )
        {
            if(  Count_Credit(p) < Count_Credit(pf) )
                Exchang(p, pf);
            pf = pf->next;
        }
        p = p->next;
    }
}
//计算同学的平均学分成绩
float Count_Credit( Student p )
{
    float sum = 0.0;
    int total = 0;

    total += p->maths.credit * p->maths.mark;
    total += p->english.credit * p->english.mark;
    total += p->chinese.credit * p->chinese.mark;

    sum += float(p->maths.credit + p->english.credit + p->chinese.credit);
    sum = total/sum;
    return sum;
}
//按总分进行排名 从高到低
void Mark_Ranking()
{
    void Exchang( Student &p1, Student &p2 );
    Student p = L->next, pf = L->next;

    if( !p )
    {
        printf("系统中没有存储学生信息!");
        return;
    }
    while( p )
    {
        pf = p->next;
        while( pf )
        {
            if(  Count_Mark(p) < Count_Mark(pf) )
                Exchang(p, pf);
            pf = pf->next;
        }
        p = p->next;
    }
}

//计算每位同学的总分
int Count_Mark( Student p )
{
    int total = 0;

    total +=  p->maths.mark;
    total +=  p->english.mark;
    total +=  p->chinese.mark;

    return total;
}

//选择一门课程进行分析 并画出直方图
void Lesson_Analysis()
{
    char string[10];
    int a[6] = {0,0,0,0,0,0};
    Student p = L->next;
    if( !p )
    {
        printf("系统中没有存储学生信息!");
        return;
    }
    printf("输入你要统计的课程名(english, chinese, maths):");
    scanf("%s", string );
    if( strcmp(string, "english") == 0 )
    {
        while( p )
        {
            a[0]++;
            if( (90<=p->english.mark) && (p->english.mark<=100) )
                a[1]++;
            if( (80<=p->english.mark) && (p->english.mark<=89) )
                a[2]++;
            if( (70<=p->english.mark) && (p->english.mark<=79) )
                a[3]++;
            if( (60<=p->english.mark) && (p->english.mark<=69) )
                a[4]++;
            if( p->english.mark<60 )
                a[5]++;
            p = p->next;
        }
    }
    else if( strcmp(string, "maths") == 0 )
    {
        while( p )
        {
            a[0]++;
            if( (90<=p->maths.mark) && (p->maths.mark<=100) )
                a[1]++;
            if( (80<=p->maths.mark) && (p->maths.mark<=89) )
                a[2]++;
            if( (70<=p->maths.mark) && (p->maths.mark<=79) )
                a[3]++;
            if( (60<=p->maths.mark) && (p->maths.mark<=69) )
                a[4]++;
            if( p->maths.mark<60 )
                a[5]++;
            p = p->next;
        }
    }
    else if( strcmp(string, "chinese") == 0 )
    {
        while( p )
        {
            a[0]++;
            if( (90<=p->chinese.mark) && (p->chinese.mark<=100) )
                a[1]++;
            if( (80<=p->chinese.mark) && (p->chinese.mark<=89) )
                a[2]++;
            if( (70<=p->chinese.mark) && (p->chinese.mark<=79) )
                a[3]++;
            if( (60<=p->chinese.mark) && (p->chinese.mark<=69) )
                a[4]++;
            if( p->chinese.mark<60 )
                a[5]++;
            p = p->next;
        }
    }
    else
        return;
    for(int i=1; i<6; i++)
    {
        int j = a[i];
        while( j )
        {
            --j;
            putchar(3);
        }
        printf("%4.2f%c\n", float(a[i]/a[0])*100, 37 );
    }
}
void Exchang( Student &p1, Student &p2 )
{
    struct LNode temp;
    strcpy(temp.name , p1->name);
    strcpy(p1->name, p2->name);
    strcpy(p2->name, temp.name);

    temp.number = p1->number;
    p1->number = p2->number;
    p2->number = temp.number;

    temp.chinese.credit = p1->chinese.credit;
    p1->chinese.credit = p2->chinese.credit;
    p2->chinese.credit = temp.chinese.credit;
    temp.chinese.mark = p1->chinese.mark;
    p1->chinese.mark = p2->chinese.mark;
    p2->chinese.mark = temp.chinese.mark;

    temp.english.credit = p1->english.credit;
    p1->english.credit = p2->english.credit;
    p2->english.credit = temp.english.credit;
    temp.english.mark = p1->english.mark;
    p1->english.mark = p2->english.mark;
    p2->english.mark = temp.english.mark;

    temp.maths.credit = p1->maths.credit;
    p1->maths.credit =     p2->maths.credit;
    p2->maths.credit = temp.maths.credit;
    temp.maths.mark = p1->maths.mark;
    p1->maths.mark =     p2->maths.mark;
    p2->maths.mark = temp.maths.mark;
}






2010-04-11 22:52
czyzhuo
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:17
帖 子:230
专家分:1459
注 册:2010-3-11
收藏
得分:0 
回复 2楼 寒风中的细雨
牛啊!
2010-04-12 09:17
寒风中的细雨
Rank: 17Rank: 17Rank: 17Rank: 17Rank: 17
等 级:贵宾
威 望:66
帖 子:1710
专家分:8645
注 册:2009-9-15
收藏
得分:0 
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>

#define  LEN  sizeof( struct LNode )
#define LESSON_SUM   3//初始化 有多少门课程

struct Subject
{
    char lessonName[12];//学科名
    int credit;//学分
    int mark;//单科成绩分
};

typedef struct LNode
{
    char name[12];
    int number;
    struct Subject sub[LESSON_SUM];
    struct LNode *next;
}*Student;

FILE *fp = NULL;
char s[LESSON_SUM][12];//课程安排
void Lesson_List()
{
    int i;
    printf("请输入%d门课程\n", LESSON_SUM );

    for( i=0; i<LESSON_SUM; i++ )
        scanf("%s", s[i] );
    printf("设置成功!\n");
}

void Reading_File( Student &L );//读取文件信息操作
void Save_File( Student L );//保存信息至文件
void Init( Student &L );//初始化链表
void Insert( Student &L );//添加学生信息
void Delete( Student &L );//删除学生信息
void Output( Student L );//输出全部信息
void Change( Student &L );//修改学生信息
void Credit_Ranking( Student &L );//按学分平均排名从高到低排
int Count_Credit( Student p );//计算同学的评价学分成绩
void Mark_Ranking( Student &L );//按总分进行排名 从高到低
int Count_Mark( Student p );//计算每位同学的总分
void Lesson_Analysis( Student L );//选择一门课程进行分析 并画出直方图
void List( Student &L );//菜单
void Init_Lesson( Student p );//初始化功课表

int main()
{
    Lesson_List();
    Student L = NULL;
    Init( L );
    Reading_File( L );
    List( L );
   
    return 0;
}
//读取文件信息操作
void Reading_File( Student &L )
{
    Student p;
    if( !(fp=fopen("d:\\studentmg.text", "r")) )
        return;
    else
        while( !feof(fp) )
        {
            p = (Student) malloc (LEN);
            fread( p, LEN, 1, fp );   
            p->next = L->next;
            L->next = p;
        }
    fclose( fp );
}
//保存信息至文件
void Save_File( Student L )
{
    Student p = L->next;
    fp = fopen("d:\\studentmg.text", "w");
    if( !fp )
        exit(0);
    while( p )
    {
        fwrite( p, LEN, 1, fp );
        p = p->next;
    }
    printf("信息保存成功!\n");
    fclose( fp );
}

//初始化链表
void Init( Student &L )
{
    L = (Student) malloc (LEN);
    if( !L )
        exit(0);
    L->next = NULL;
}
//添加学生信息
void Insert( Student &L )
{
    Student p = L->next, temp;
    int num, i;

loop:
    printf("输入要添加学生学号:");
    scanf("%d", &num );
    p = L->next;
    while( p )
    {
        if( p->number == num )
            goto loop;
        p = p->next;
    }
    temp = (Student) malloc (LEN);
    if( !temp ) exit(0);
    /////////////////////////////添加的信息   
    temp->number = num;
    Init_Lesson( temp );//printf("到达初始化");
    printf("输入学生姓名:");
    scanf("%s", temp->name );
    for( i=0; i<LESSON_SUM; i++ )
    {
        printf("输入%s的学分和成绩:", temp->sub[i].lessonName );
        scanf("%d%d", &temp->sub[i].credit, &temp->sub[i].mark );
    }
    temp->next = L->next;
    L->next = temp;
    printf("添加信息成功!\n");
}
//删除学生信息
void Delete( Student &L )
{
    Student p = L->next, pf = L;
    int num;

    if( !p )
    {
        printf("系统中没有存储学生信息!");
        return;
    }
    printf("输入要删除学生的学号:");
    scanf("%d", &num );
    while( p && (p->number!=num) )
    {
        pf = pf->next;
        p = p->next;
    }
    if( !p )
        printf("没有查到该学生的信息!");
    else
    {
        pf->next = p->next;
        printf("删除成功!\n");
    }
    free( p );
   
}
//输出全部信息
void Output( Student L )
{
    Student p = L->next;
    int i;
    if( !p )
    {
        printf("系统中没有存储学生信息!");
        return;
    }
    while( p != NULL )
    {
        printf("学生姓名:%s\n", p->name );
        printf("学生的学号:%d\n", p->number );
        for( i=0; i<LESSON_SUM; i++ )
        {
            printf("%s的学分和成绩:", p->sub[i].lessonName );
            printf("%d %d\n", p->sub[i].credit, p->sub[i].mark );
        }
        p = p->next;
    }
    free(p);
}   
//修改学生信息
void Change( Student &L )
{
    Student p = L->next;
    int num, i;

    if( !p )
    {
        printf("系统中没有存储学生信息!");
        return;
    }
    printf("输入你要查找学生的学号:");
    scanf("%d", &num );

    while( p && (p->number!=num) )
        p = p->next;
    if( !p )
        printf("没有查到该学生的信息!");
    else
    {
        printf("输入修改学生姓名为:");
        scanf("%s", p->name );
        for( i=0; i<LESSON_SUM; i++ )
        {
            printf("输入%s的学分和成绩分别改为:", p->sub[i].lessonName );
            scanf("%d%d", &p->sub[i].credit, &p->sub[i].mark );
        }
    }
    printf("修改信息成功!\n");
}

//按学分平均排名从高到低排
void Credit_Ranking( Student &L )
{
    Student d, p = L->next, fd = L, temp = L->next;

    if( !p || !p->next )
        return;
    while( temp )
    {
        d = p = temp;
        fd = L->next;
        while( p )
        {
            if(  Count_Mark(p) < Count_Mark(d) )
            {
                d = p;
                while( fd->next != d )
                    fd = fd->next;
            }
            p = p->next;
        }
        if( d == temp )
            temp = temp->next;
        fd->next = d->next;
        d->next = L->next;
        L->next = d;
    }
    printf("操作成功!\n");
}
//计算同学的学分成绩
int Count_Credit( Student p )
{
    int total = 0, i;

    for( i=0; i<LESSON_SUM; i++ )   
        total += p->sub[i].credit * p->sub[i].mark;
        
    return total;
}
//按总分进行排名 从高到低
void Mark_Ranking( Student &L )
{
    Student d, p = L->next, fd = L, temp = L->next;

    if( !p || !p->next )
        return;
    while( temp )
    {
        d = p = temp;
        fd = L->next;
        while( p )
        {
            if(  Count_Mark(p) < Count_Mark(d) )
            {
                d = p;
                while( fd->next != d )
                    fd = fd->next;
            }
            p = p->next;
        }
        if( d == temp )
            temp = temp->next;
        fd->next = d->next;
        d->next = L->next;
        L->next = d;
    }
    printf("操作成功!\n");
}

//计算每位同学的总分
int Count_Mark( Student p )
{
    int total = 0, i;

    for( i=0; i<LESSON_SUM; i++ )   
        total += p->sub[i].mark;

    return total;
}

//选择一门课程进行分析 并画出直方图
void Lesson_Analysis( Student L )
{
    char string[12];
    int a[6] = {0,0,0,0,0,0}, i;
    Student p = L->next;
    if( !p )
    {
        printf("系统中没有存储学生信息!");
        return;
    }
    printf("所有课程如下:\n");
    for( i=0; i<LESSON_SUM; i++ )   
        printf("%s\n", s[i] );
    printf("输入你要统计的课程名:");
    scanf("%s", string );
    getchar();

    for( i=0; i<LESSON_SUM; i++ )
    {
        if( strcmp(string, p->sub[i].lessonName) == 0 )
        {
            while( p )
            {
                a[0]++;
                if( (90<=p->sub[i].mark) && (p->sub[i].mark<=100) )
                    a[1]++;
                if( (80<=p->sub[i].mark) && (p->sub[i].mark<=89) )
                    a[2]++;
                if( (70<=p->sub[i].mark) && (p->sub[i].mark<=79) )
                    a[3]++;
                if( (60<=p->sub[i].mark) && (p->sub[i].mark<=69) )
                    a[4]++;
                if( p->sub[i].mark<60 )
                    a[5]++;
                p = p->next;
            }
            break;
        }
    }
    if( !p )
    {
        for( i=1; i<6; i++)
        {
            int j = a[i];
            while( j )
            {
                --j;
                putchar(3);
            }
            printf("%4.2f%c\n", float(a[i]/a[0])*100, 37 );
        }
    }
}
//菜单
void List( Student &L )
{
        while(1)
    {
        int i;
        printf("\n~~~~~~~~~~~~~~~请按照下面提示进行相应的操作!\n");
        printf("~~~~~~~~~~~~~~~*按'1'进行添加学生信息*\n");
        printf("~~~~~~~~~~~~~~~*按'2'进行删除学生信息*\n");
        printf("~~~~~~~~~~~~~~~*按'3'输出全部学生信息*\n");
        printf("~~~~~~~~~~~~~~~*按'4'进行修改学生信息*\n");
        printf("~~~~~~~~~~~~~~~*按'5'按平均学分成绩从高到低排名*\n");
        printf("~~~~~~~~~~~~~~~*按'6'按总分进行从高到低排名*\n");
        printf("~~~~~~~~~~~~~~~*按'7'选择学科进行成绩分析*\n");
        printf("~~~~~~~~~~~~~~~*按'8'进行信息保存*\n");
        printf("~~~~~~~~~~~~~~~*按'9'退出系统*\n");
        scanf("%d", &i );

        switch( i )
        {
        case 1:
            Insert( L );
            break;
        case 2:
            Delete( L );
            break;
        case 3:
            Output( L );
            break;
        case 4:
            Change( L );
            break;
        case 5:
            Credit_Ranking( L );
            break;
        case 6:
            Mark_Ranking( L );
            break;
        case 7:
            Lesson_Analysis( L );
            break;
        case 8:
            Save_File( L );
            break;
        case 9:
            exit(0);
            break;
        }
    }
}
//初始化功课表
void Init_Lesson( Student p )
{   
    int i;

    for( i=0; i<LESSON_SUM; i++ )
        strcpy( p->sub[i].lessonName, s[i] );
}







2010-04-12 19:04
快速回复:求此成绩管理题的编程
数据加载中...
 
   



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

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