| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 436 人关注过本帖
标题:很小的成绩管理程序 我有些问题请教
只看楼主 加入收藏
baibaijie
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2008-8-20
收藏
 问题点数:0 回复次数:0 
很小的成绩管理程序 我有些问题请教
设计一个简单的学生成绩管理程序,要求根据菜单处理相应功能。
(1)管理功能包括列表,求平均成绩、查找最高分。
(3)可以实现按平均成绩排序;
(4)求平均成绩可按个人或科目进行;
(5)查找可按最高个人平均分进行,或按指定科目的最高分进行;
(6)每个学生的信息包括:学号、性别、成绩1、成绩2、成绩3、成绩4;
(7)基本功能为:建立文件、增加学生记录、新建学生信息文件、删除/修改学生记录

程序我还未完成 部分函数已经写了 如下
#include"stdio.h"
#include"stdlib.h"

enum gender {male,female};

typedef struct studentinfo
{
    int studentnum;/*学生学号*/
    enum gender sex;
    float score[4];
    studentinfo *next;
}

studentinfo *last;
studentinfo *head;
studentinfo *p;

void average-single(int x)/*单人平均分*/
{
    p=head;
    p=p.next;
    while(p.studentnum!=x&&p.next!=NULL)
        p=p.next;
    if(p.studentnum!=x&&p.next==NULL)
        printf("wrong student number");
    else printf("%f",(p.score[0]+p.score[1]+p.score[2]+p.score[3])/4);
}

void average-subject(int x)/*科目平均分*/
{
    float sum=0;
    int count=0;
    p=head;
    p=p.next;
    while(p.next!=NULL)
    {
        sum+=p.score[x];
        count++;
        p=p.next;
    }
    sum+=p.score[x];
    count++;
    printf("%f",sum/count);
}

void highestscore(int x)/*查找单科最高分*/
{
    p=head;
    p=p.next;
    float curhiest;
    curhiest=p.score[x];
    while(p.next!=NULL)
    {
        if(p.score[x]>curhiest)
            curhiest=p.score[x];
        p=p.next;
    }
    if(p.score[x]>curhiest)
            curhiest=p.score[x];
    printf("%f",curhiest);
}

void modify(int x)/*修改成绩*/
{
    int a;
    p=head;
    p=p.next;
    while(p.studentnum!=x&&p.next!=NULL)
        p=p.next;
    if(p.studentnum!=x&&p.next==NULL)
        printf("wrong student number");
    else
    {
        printf("请输入要修改第几项成绩");
        scanf("%d",&a);
        printf("请输入成绩");
        scanf("%f",p.score[a]);
        printf("操作成功");
    }
}

void newinfo();/*新节点*/
{
    studentinfo *temp;
    p=last;
    temp=(studentinfo *)malloc(sizeof(studentinfo));
    p.next=temp;
    last=temp;
    printf("please input student's number");
    scanf("%d",p.studentnum);
    printf("please input student's gender. 0 for male, 1 for female");
    scanf("%d",p.sex);
    printf("please input the student`s 4 scores");
    scanf("%f %f %f %f",p.score[0],p.score[1],p.score[2],p.score[3]);
    printf("operation done")
}

最开始的枚举变量我不太会用 如果有错请指点
我是使用链表来储存信息
但是我不会建立文件来储存链表
也就是每次运行程序链表只有一个头节点,程序关闭所有新建的节点都回消失
这点请高手教教我
还有就是请介绍一下怎么建立图形界面阿?
我是用visual studio 2005的

谢谢了~
搜索更多相关主题的帖子: 管理程序 
2008-11-19 20:24
快速回复:很小的成绩管理程序 我有些问题请教
数据加载中...
 
   



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

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