精华内容
下载资源
问答
  • 程序设计基础实训 项目名称 学生学分管理 系 别 计算机工程系 专 业 计算机网络技术 班 级 学生姓名 指导教师 一项目背景介绍 概要介绍此项目设计的意义和要求 c 本程序为学生学分管理系统本程序根据现实中的问题...
  • 程序设计基础实训 项目名称 学生学分管理 系 别 计算机...本程序为学生学分管理系统本程序根据现实中的问题通过c语言形式编程本程序要求能够登记学分显示学分查询学分修改学分删除学分统计学分 二程序功能描述 描述基本
  • 1 引言 现今大学对学生成绩管理以及学生水平评定过程中不仅依靠学生分数而 且把各个科目的掌握情况通过学分来反映众所周知大学人数众多 单靠人 工在纸质介质上记录既浪费资源又不方便管理并且错误率高学分管理系统 ...
  • 基于C语言的控制台界面的简单的学生学分管理系统
  • 现今大学对学生成绩管理以及学生水平评定过程中不仅依靠学生分数而 且把各个科目的掌握情况通过学分来反映众所周知大学人数众多单靠人 工在纸质介质上记录既浪费资源又不方便管理并且错误率高学分管理系统 ...
  • 实现一个简单的学生学分管理系统 假设每位学生必须完成基础课50学分、专业课50学分、选修课24学分、人文类课程8学分、实验性课程20学分才能够毕业。因此在管理学分时,要考虑每个学分所属于的课程类别。 该程序应该...
  • /*****************************************************************************//*制作一个学籍管理系统:要求包含以下模块,模块用子函数完成1)输入若干条(20)条记录(包含学号,姓名,科目,科目成绩,学期学分...

    /*****************************************************************************/

    /*

    制作一个学籍管理系统:要求包含以下模块,模块用子函数完成1)输入若干条(20)条记录(包含学号,姓名,科目,科目成绩,学期学分)2)显示所有记录3)按学号排序4)插入一条记录5)查找并显示一条记录6)按姓名查找并删除一条记录7)显示统计信息  PS:因为是初学,不要用指针,用函数的做法做吧~~别做的太高端了。

    学籍管理系统

    姓名:****              学校:湖南理工学院信息学院              专业:信息工程

    */

    /*****************************************************************************/

    //姓名,学号,英语,语文,数学三种成绩

    #include

    #include

    #include

    #define maxnumber 30

    int student_number;

    int count1=0,count2=0,Operate1=3;

    //FILE *stream;

    typedef struct stu{

    int idnumber;

    char name[20];

    double English_score;

    double chinese_score;

    double math_score;

    }Student;

    //按学号排序

    void putout_one(Student *sp)

    {

    for( int j=0;j<10;j++)

    printf("******");

    printf("\n");

    printf("     %d    %s              %.1f %.1f         %.1f\n",(*sp).idnumber,(*sp).name,(*sp).English_score,(*sp).chinese_score,(*sp).math_score);

    for( j=0;j<10;j++)

    printf("******");

    printf("\n");

    }

    void putout_lot(Student *student)

    {

    for(int i=0;i<=Operate1;i++)

    {

    for(int j=0;j<10;j++)

    printf("******");

    printf("\n");

    printf("     %d    %s              %.1f %.1f         %.1f\n",student[i].idnumber,student[i].name,student[i].English_score,student[i].chinese_score,student[i].math_score);

    }

    for( int j=0;j<10;j++)

    printf("******");

    printf("\n");

    }

    void input_student(Student *S)//输入插入学生的信息

    {

    //printf("请输入第%d位学生(学号,名字,语文,英语,数学)\n",i+1);

    scanf("%d",&(*S).idnumber);

    scanf("%s",&(*S).name);

    scanf("%lf%lf%lf",&(*S).chinese_score,&(*S).English_score,&(*S).math_score);

    }

    void id_find_in(Student *S,Student *q)//把新的学生信息加入表单

    {

    Student *p=S,*t;

    while(count1

    {

    t=p;

    p++;

    count1++;

    }

    *t=*q;

    count1=0;

    Operate1++;

    }

    void insert_element(Student *S)//插入学生信息

    {

    printf("请输入1位学生(学号,名字,语文,英语,数学)\n");

    Student *temp=(Student *)malloc(sizeof(Student)),*q=S;

    input_student(temp);

    id_find_in(S,temp);

    }

    void delet_element(Student *S,int id_n)

    {

    Student *p=S,*t;

    while(count1

    {

    if((*p).idnumber==id_n)

    {

    t=p;

    printf("已删除%d号学生信息\n",(*p).idnumber);

    while(count2

    {

    *(t-1)=*(++t);

    count2++;

    }

    break;

    }

    count1++;

    p++;

    }

    count1=0;

    count2=0;

    Operate1--;

    }

    int junge(char*a,char*b)

    {

    char *p=a,*q=b;

    while(*p!='\0')

    {

    if(*p==*q)

    {

    p++;

    q++;

    continue;

    }

    else

    break;

    }

    if(*p=='\0'&&*q=='\0')

    return 1;

    else

    return 0;

    }

    void show_stu_element(Student*S,char*sp)//显示某人信息(功能已实现)

    {

    Student *p=S;

    while(count1

    {

    if(junge((*p).name,sp))

    {

    printf("已找到此人:%s\n",(*p).name);

    putout_one(p);

    p=S;

    break;

    }

    else

    {

    p++;

    count1++;

    continue;

    }

    }

    if(p!=S)

    printf("查无此人!\n");

    count1=0;

    }

    void id_sort(Student *S)

    {

    Student *temp=(Student*)malloc(sizeof(Student)),*q=S,*t;

    int num=Operate1;

    while(count1

    {

    t=q+1;

    while(count2

    {

    if( (*q).idnumber> (*t).idnumber)

    {

    *temp=*q;

    *q=*t;

    *(t)=*temp;

    //      printf("%d\n",(*t).idnumber);

    }

    count2++;

    t++;

    }

    num--;

    q++;

    count2=0;

    count1++;

    //q=q+sizeof(Student);

    }

    count1=0;

    count2=0;

    }

    void count_passnumber(Student *S)

    {

    Student *p=S;

    int e_p_number=0,m_p_number=0,c_p_number=0,num=0;

    while(num<=Operate1)

    {

    if(p->English_score>=60)

    e_p_number++;

    if(p->math_score>=60)

    m_p_number++;

    if(p->chinese_score>=60)

    c_p_number++;

    num++;

    p++;

    }

    printf("/***学生总人数=:%d\n",Operate1);

    printf("/***英语过关人数=%d       数学过关人数=%d 语文过关人数=%d\n",e_p_number,m_p_number,c_p_number);

    printf("/***英语挂科人数=%d       数学挂科人数=%d 语文挂科人数=%d\n",Operate1+1-e_p_number,Operate1+1-m_p_number,Operate1+1-c_p_number);//因为数组下标是从0开始的

    }

    void main()

    {

    Student student[maxnumber];

    //stream=freopen("in.txt","r",stdin);

    int Operate=3;int i;int id_n;

    char student_element[20];

    for(i=0;i

    {

    printf("请输入第%d位学生(学号,名字,语文,英语,数学)\n",i+1);

    scanf("%d",&student[i].idnumber);

    scanf("%s",&student[i].name);

    scanf("%lf%lf%lf",&student[i].chinese_score,&student[i].English_score,&student[i].math_score);

    }

    //fclose(stream);

    for( i=0;Operate!=0;i++)

    {

    printf("输入:0.退出。\n1.输入学生信息\n2.按姓名查找并删除学生信息\n3.按学号排序\n4.查找显示一位学生信息     \n5.显示统计记录(成员数、每科平均分)\n6.输出每科及格人数和不及格人数\n7(default).操作完成,等待用户输入:\n");

    scanf("%d",&Operate);

    switch(Operate)

    {

    case 1:insert_element(student);     break;

    case 2:      scanf("%d",&id_n);  delet_element(student,id_n);       break;

    case 3:id_sort(student);break;

    case 4:scanf("%s",student_element);  show_stu_element(student,student_element);break;

    case 5:system(“cls”);  putout_lot(student);break;

    case 6:count_passnumber(student);break;

    default:    printf("请输入:\n");continue;

    }

    if(Operate==0)

    break;

    }

    }

    893681576bd4590bb7db61740f3a12bf.png

    d412b71cc8cf421ee849c170807bea3b.png

    加入了一个统计函数后的结果!

    ------------------------------------------------------------------------------------------------------2013年5月19日作

    展开全文
  • 3)学生成绩管理系统  需要处理的基础数据 学生基本信息:如班级、学号、姓名、性别、年龄等。 学生选修课程的基本信息:课程编号、课程名称、学分、考试成绩、平时成绩、综合成绩(考试成绩*0.7+平时成绩*0.3...
  • C语言,链表实现学生信息管理系统 问题分析及任务描述 用链表这种存储结构,每个学生作为一个数据元素,包括date1(每个学生的信息),date2(每个学生的成绩信息)这两个数据项,用结构体详细定义date1中的学号,姓名...

    C语言,链表实现学生信息管理系统

    问题分析及任务描述

    用链表这种存储结构,每个学生作为一个数据元素,包括date1(每个学生的信息),date2(每个学生的成绩信息)这两个数据项,用结构体详细定义date1中的学号,姓名,性别、年龄,date2中的成绩、学分、通过形式(考试、补考、重修)、学期和学期信息。

    具体要解决的问题有如下6个
    (1)使用中文菜单
    (2)将学生信息保存在链表中
    (3)初始状态已包含5名学生信息,在此基础上进行输入、删除、按学号排序等操作。
    (4)成绩统计:计算总分、平均分和学分绩点,并按总分降序排列显示出来。输入科目名, 显示出该科平均分,最高分最低分
    (5)多种查询(如学号、姓名、成绩等)及输出功能
    (6)所有操作完成,或者在相应的命令后,再将学生信息保存到文本文档中

    程序代码

    下面展示一些 内联代码片

    #include <stdio.h>
    #include <stdlib.h>
    #include <stdbool.h>
    #include <string.h>
    #include <stdlib.h>
    //学号长度
    #define NO_LENGTH 20
    //姓名长度
    #define NAME_LENGTH 11
    //性别长度
    #define SEX_LENGTH 5
    //通过形式长度
    #define PASTYP_LENGTH 8
    //学分长度
    #define CREDIT_LENGTH 5
    //定义学生结构体的数据结构
    typedef struct Student
    {
        char studentNo[NO_LENGTH];//学号
        char studentName[NAME_LENGTH];//姓名
        char studentSex[SEX_LENGTH];//性别
        int studentAge;//年龄
    } St;
    typedef struct Score
    {
        int scoreMath;//数学成绩
        char creditMath[CREDIT_LENGTH];//数学学分
        char pasMath[PASTYP_LENGTH];//数学通过方式
        int termMath;//学期
    
        int scoreEgls;//英语成绩
        char creditEgls[CREDIT_LENGTH];//英语学分
        char pasEgls[PASTYP_LENGTH];//英语通过方式
        int termEgls;//学期
    
        int scoreComp;//计算机成绩
        char creditComp[CREDIT_LENGTH];//计算机学分
        char pasComp[PASTYP_LENGTH];//计算机通过方式
        int termComp;//学期
    
        int scoreSport;//体育成绩
        char creditSport[CREDIT_LENGTH];//体育学分
        char pasSport[PASTYP_LENGTH];//体育通过方式
        int termSport;//学期
    
        int scoreChinese;//马原成绩
        char creditChinese[CREDIT_LENGTH];//马原学分
        char pasChinese[PASTYP_LENGTH];//马原通过方式
        int termChinese;//学期
    
    }Sc;
    
    //定义结点的数据结构
    typedef struct node
    {
        St date1;
        Sc date2;
        struct node *next;//定义头结点的指针域
    } Node, *Link;
    
    //初始化学生信息,成绩
    void createList1(Link head);
    void createList2(Link head);
    void createList3(Link head);
    void createList4(Link head);
    void createList5(Link head);
    //功能菜单
    void myMenu(void);
    //输入学生信息
    void inputNode(Link p);
    //新增学生记录
    bool addNode(Link head);
    //删除学生记录
    bool deleteNode(Link head);
    //输入学号
    void inputStudentNo(char s[], char no[]);
    //输入姓名
    void inputStudentName(char s[],char name[]);
    //打印链表,指针不指向下一个
    void displayNode1(Link head);
    //打印链表
    void displayNode(Link head);
    //查询学生记录
    bool queryNode(Link head);
    //插入一个学生记录
    void insertNode(Link head, Link newNode);
    //修改学生记录
    bool modifyNode(Link head);
    //统计学生人数
    int countNode(Link head);
    //清除链表
    void clearLink(Link head);
    //成绩统计
    void statisticsNode(Link head);
    //保存到文件
    void printfile(Link head);
    //排序并插入
    void insertsort(Link head,Link newNode);
    
    int main(void)
    {
        int select;//功能选项代码
        int count; //学生人数
        Link head;//头指针
    
        head = (Link)malloc(sizeof(Node));
        head->next = NULL;
    
        createList1(head);
        createList2(head);
        createList3(head);
        createList4(head);
        createList5(head);
    
        while (1)
        {
            myMenu();
            printf("\n请输入你的选择(1-9):");
            scanf("%d", &select);
    
            switch (select)
            {
            case 1://增加学生记录
                if (addNode(head))
                {
                    printf("成功增加一个学生记录。\n");
                }
                break;
            case 2://删除学生记录
                if (deleteNode(head))
                {
                    printf("成功删除一个学生记录。\n");
                }
                else
                {
                    printf("没有找到要删除的学生记录。\n");
                }
                break;
            case 3://查找学生记录
                if (queryNode(head))
                {
                    printf("成功找到学生记录。\n");
                }
                else
                {
                    printf("没有找到要查询的学生记录。\n");
                }
                break;
            case 4://修改学生记录
                if (modifyNode(head))
                {
                    printf("成功修改一个学生记录。\n");
                }
                else
                {
                    printf("没有找到要修改的学生记录。\n");
                }
                break;
            case 5://统计学生记录
                count = countNode(head);
                printf("学生人数为:%d\n", count);
                break;
            case 6://显示学生记录
                displayNode(head);
                break;
            case 7://成绩统计
                statisticsNode(head);
                break;
            case 8://保存到文件
                printfile(head);
                break;
            case 9://退出系统
                clearLink(head);
                break;
                return 0;
                ;
               default:
                printf("输入不正确,请输入1-9之间的数。\n");
                break;
            }
        }
    }
    
    //功能菜单
    void myMenu(void)
    {
        printf("\n");
        printf(" * * * * * * * * * 菜     单 * * * * * * * * * *\n");
        printf("     1 增加学生记录            2 删除学生记录       \n");
        printf("     3 查找学生记录            4 修改学生记录       \n");
        printf("     5 统计学生人数            6 显示学生记录       \n");
        printf("     7 成绩统计                8 保存到文件         \n");
        printf("     9 退出系统\n");
        printf(" * * * * * * * * * * * * * * * * * * * * * * * *\n");
    }
    
    //初始化五个学生信息,成绩
    void createList1(Link head)
    {
        Link newNode;//空结点指针
        newNode = (Link)malloc(sizeof(Node));
        strcpy(newNode->date1.studentNo,"1910903");
        strcpy(newNode->date1.studentName,"三");
        strcpy(newNode->date1.studentSex,"女");
        newNode->date1.studentAge=19;
    
        newNode->date2.scoreMath=88;
        strcpy(newNode->date2.creditMath,"3.5");
        strcpy(newNode->date2.pasMath,"考试");
        newNode->date2.termMath=1;
    
        newNode->date2.scoreEgls=90;
        strcpy(newNode->date2.creditEgls,"3.7");
        strcpy(newNode->date2.pasEgls,"考试");
        newNode->date2.termEgls=1;
    
        newNode->date2.scoreComp=85;
        strcpy(newNode->date2.creditComp,"3.4");
        strcpy(newNode->date2.pasComp,"考试");
        newNode->date2.termComp=1;
    
        newNode->date2.scoreSport=80;
        strcpy(newNode->date2.creditSport,"3.0");
        strcpy(newNode->date2.pasSport,"考试");
        newNode->date2.termSport=1;
    
        newNode->date2.scoreChinese=85;
        strcpy(newNode->date2.creditChinese,"3.5");
        strcpy(newNode->date2.pasChinese,"考试");
        newNode->date2.termChinese=1;
        newNode->next = NULL;
    
        insertsort(head,newNode);
        }
    
    void createList2(Link head)
    {
        Link newNode;//空结点指针
        newNode = (Link)malloc(sizeof(Node));
        strcpy(newNode->date1.studentNo,"1910902");
        strcpy(newNode->date1.studentName,"二");
        strcpy(newNode->date1.studentSex,"男");
        newNode->date1.studentAge=19;
    
        newNode->date2.scoreMath=95;
        strcpy(newNode->date2.creditMath,"3.8");
        strcpy(newNode->date2.pasMath,"考试");
        newNode->date2.termMath=1;
    
        newNode->date2.scoreEgls=91;
        strcpy(newNode->date2.creditEgls,"3.7");
        strcpy(newNode->date2.pasEgls,"考试");
        newNode->date2.termEgls=1;
    
        newNode->date2.scoreComp=83;
        strcpy(newNode->date2.creditComp,"3.3");
        strcpy(newNode->date2.pasComp,"考试");
        newNode->date2.termComp=1;
    
        newNode->date2.scoreSport=81;
        strcpy(newNode->date2.creditSport,"3.1");
        strcpy(newNode->date2.pasSport,"考试");
        newNode->date2.termSport=2;
    
        newNode->date2.scoreChinese=86;
        strcpy(newNode->date2.creditChinese,"3.5");
        strcpy(newNode->date2.pasChinese,"考试");
        newNode->date2.termChinese=1;
        newNode->next = NULL;
    
        insertsort(head,newNode);
        }
        void createList3(Link head)
    {
        Link newNode;//空结点指针
        newNode = (Link)malloc(sizeof(Node));
        strcpy(newNode->date1.studentNo,"1910901");
        strcpy(newNode->date1.studentName,"一");
        strcpy(newNode->date1.studentSex,"女");
        newNode->date1.studentAge=19;
    
        newNode->date2.scoreMath=70;
        strcpy(newNode->date2.creditMath,"2.8");
        strcpy(newNode->date2.pasMath,"重修");
        newNode->date2.termMath=1;
    
        newNode->date2.scoreEgls=97;
        strcpy(newNode->date2.creditEgls,"3.7");
        strcpy(newNode->date2.pasEgls,"考试");
        newNode->date2.termEgls=1;
    
        newNode->date2.scoreComp=85;
        strcpy(newNode->date2.creditComp,"3.4");
        strcpy(newNode->date2.pasComp,"考试");
        newNode->date2.termComp=1;
    
        newNode->date2.scoreSport=80;
        strcpy(newNode->date2.creditSport,"3.0");
        strcpy(newNode->date2.pasSport,"补考");
        newNode->date2.termSport=5;
    
        newNode->date2.scoreChinese=86;
        strcpy(newNode->date2.creditChinese,"3.6");
        strcpy(newNode->date2.pasChinese,"考试");
        newNode->date2.termChinese=1;
        newNode->next = NULL;
    
        insertsort(head,newNode);
        }
        
        void createList4(Link head)
    {
        Link newNode;//空结点指针
        newNode = (Link)malloc(sizeof(Node));
        strcpy(newNode->date1.studentNo,"1910904");
        strcpy(newNode->date1.studentName,"四");
        strcpy(newNode->date1.studentSex,"男");
        newNode->date1.studentAge=20;
    
        newNode->date2.scoreMath=88;
        strcpy(newNode->date2.creditMath,"3.4");
        strcpy(newNode->date2.pasMath,"考试");
        newNode->date2.termMath=1;
    
        newNode->date2.scoreEgls=60;
        strcpy(newNode->date2.creditEgls,"2.1");
        strcpy(newNode->date2.pasEgls,"重修");
        newNode->date2.termEgls=5;
    
        newNode->date2.scoreComp=85;
        strcpy(newNode->date2.creditComp,"3.4");
        strcpy(newNode->date2.pasComp,"考试");
        newNode->date2.termComp=1;
    
        newNode->date2.scoreSport=81;
        strcpy(newNode->date2.creditSport,"3.0");
        strcpy(newNode->date2.pasSport,"考试");
        newNode->date2.termSport=1;
    
        newNode->date2.scoreChinese=86;
        strcpy(newNode->date2.creditChinese,"3.5");
        strcpy(newNode->date2.pasChinese,"考试");
        newNode->date2.termChinese=1;
        newNode->next = NULL;
    
        insertsort(head,newNode);
        }
        
        void createList5(Link head)
    {
        Link newNode;//空结点指针
        newNode = (Link)malloc(sizeof(Node));
        strcpy(newNode->date1.studentNo,"1910905");
        strcpy(newNode->date1.studentName,"五");
        strcpy(newNode->date1.studentSex,"女");
        newNode->date1.studentAge=19;
    
        newNode->date2.scoreMath=86;
        strcpy(newNode->date2.creditMath,"3.5");
        strcpy(newNode->date2.pasMath,"考试");
        newNode->date2.termMath=1;
    
        newNode->date2.scoreEgls=90;
        strcpy(newNode->date2.creditEgls,"3.7");
        strcpy(newNode->date2.pasEgls,"补考");
        newNode->date2.termEgls=1;
    
        newNode->date2.scoreComp=85;
        strcpy(newNode->date2.creditComp,"3.4");
        strcpy(newNode->date2.pasComp,"考试");
        newNode->date2.termComp=8;
    
        newNode->date2.scoreSport=90;
        strcpy(newNode->date2.creditSport,"3.5");
        strcpy(newNode->date2.pasSport,"考试");
        newNode->date2.termSport=1;
    
        newNode->date2.scoreChinese=85;
        strcpy(newNode->date2.creditChinese,"3.5");
        strcpy(newNode->date2.pasChinese,"考试");
        newNode->date2.termChinese=1;
        newNode->next = NULL;
    
        insertsort(head,newNode);
        }
    
    //插入并排序
        void insertsort(Link head,Link newNode)
    {
        Link q,p;
        p=head;//用作标记
        q=head->next;//用作比较
        bool flag=false; //是否增加成功
        //如果是空链表
       if (head->next==NULL)
        {
            head->next=newNode;
            flag=true;
        }
        else
        {
            while (q!=NULL)
            {
                if (strcmp(newNode->date1.studentNo,q->date1.studentNo) < 0)
                {
                    p->next=newNode;
                    newNode->next=q;
                    flag=true;
                    break;
                }
                else
                {
                    p=q;
                    q=q->next;
                }
            }
        }
        if(q==NULL&&flag==false)
        {
            p->next=newNode;
            flag=true;
        }
        return flag;
    }
    
    //增加学生记录
    bool addNode(Link head)
    {
        Link p, q;
        Link newNode;//空结点指针
        int n,i;
        bool flag = false; //是否增加成功
        printf("请输入想要输入的学生信息数:");
        scanf("%d",&n);
        for(i=0;i<n;i++)
        {
        newNode=(Link)malloc(sizeof(Node));
        inputNode(newNode);
        insertsort(head,newNode);
    
        }
        return flag;
    }
    
    void inputNode(Link newNode)
    {
        printf("----------------------------------------------------------------------------\n");
        printf("请输入学生学号:");
        scanf("%s", newNode->date1.studentNo);
        printf("请输入学生姓名:");
        scanf("%s", newNode->date1.studentName);
        printf("请输入学生性别:");
        scanf("%s",newNode->date1.studentSex);
        printf("请输入学生年龄:");
        scanf("%d",&newNode->date1.studentAge);
    
        printf("----------------------------------------------------------------------------\n");
        printf("请输入学生数学成绩:");
        scanf("%d",&newNode->date2.scoreMath);
        printf("请输入学生数学学分:");
        scanf("%s",newNode->date2.creditMath);
        printf("请输入学生数学通过方式:");
        scanf("%s",newNode->date2.pasMath);
        printf("请输入学期:");
        scanf("%d",&newNode->date2.termMath);
    
        printf("-----------------------------------------------------------------------------\n");
        printf("请输入学生英语成绩:");
        scanf("%d",&newNode->date2.scoreEgls);
        printf("请输入学生英语学分:");
        scanf("%s",newNode->date2.creditEgls);
        printf("请输入学生英语通过方式:");
        scanf("%s",newNode->date2.pasEgls);
        printf("请输入学期:");
        scanf("%d",&newNode->date2.termEgls);
    
        printf("-----------------------------------------------------------------------------\n");
        printf("请输入学生计算机成绩:");
        scanf("%d",&newNode->date2.scoreComp);
        printf("请输入学生计算机学分:");
        scanf("%s",newNode->date2.creditComp);
        printf("请输入学生计算机通过方式:");
        scanf("%s",newNode->date2.pasComp);
        printf("请输入学期:");
        scanf("%d",&newNode->date2.termComp);
    
        printf("-----------------------------------------------------------------------------\n");
        printf("请输入学生体育成绩:");
        scanf("%d",&newNode->date2.scoreSport);
        printf("请输入学生体育学分:");
        scanf("%s",newNode->date2.creditSport);
        printf("请输入学生体育通过方式:");
        scanf("%s",newNode->date2.pasSport);
        printf("请输入学期:");
        scanf("%d",&newNode->date2.termSport);
    
        printf("-----------------------------------------------------------------------------\n");
        printf("请输入学生马原成绩:");
        scanf("%d",&newNode->date2.scoreChinese);
        printf("请输入学生马原学分:");
        scanf("%s",newNode->date2.creditChinese);
        printf("请输入学生马原通过方式:");
        scanf("%s",newNode->date2.pasChinese);
        printf("请输入学期:");
        scanf("%d",&newNode->date2.termChinese);
        printf("----------------------------------------------------------------------------\n");
        newNode->next = NULL;//尾结点指针域置空
    }
    
    //按照给定的学号删除学生记录,如果删除成功返回true,否则返回false
    bool deleteNode(Link head)
    {
        char no[NO_LENGTH]; //要删除学生的学号
        Link p, q;
    
        inputStudentNo("删除", no);
        p = head;
        q = head->next;
    
        while (q!=NULL)
        {
            if (strcmp(q->date1.studentNo,no) == 0)//找到相同的学号
            {
                p->next=q->next;
                free(q);
                return true;
            }
            else
            {
                p=q;
                q=q->next;//未找到,下一个结点
            }
        }
        return false;
    }
    void inputStudentNo(char s[], char no[])
    {
        printf("请输入要%s的学生学号:",s);
        scanf("%s",no);
    }
    void inputStudentName(char s[],char name[])
    {
        printf("请输入要%s的学生姓名:",s);
        scanf("%s",name);
    }
    
    
    //打印链表
    void displayNode(Link head)
    {
        printf("\n\t***学生信息***\n");
        Link p=head->next;
        while (p!= NULL)
        {
            printf("-----------------------------------------------------------------------------\n");
            printf("\t  \t学号\t\t姓名\t\t性别\t\t年龄\n");
            printf("\t  \t%s\t\t%s\t\t%s\t\t%d\n", p->date1.studentNo, p->date1.studentName,p->date1.studentSex,p->date1.studentAge);
            printf("\t  \t--------------------------------------------------\n");
            printf("\t  \t成绩\t\t学分\t\t方式\t\t学期\n");
            printf("\t数学 \t%d\t\t%s\t\t%s\t\t%d\n",p->date2.scoreMath,p->date2.creditMath,p->date2.pasMath,p->date2.termMath);
            printf("\t英语 \t%d\t\t%s\t\t%s\t\t%d\n",p->date2.scoreEgls,p->date2.creditEgls,p->date2.pasEgls,p->date2.termEgls);
            printf("\t计算机\t%d\t\t%s\t\t%s\t\t%d\n",p->date2.scoreComp,p->date2.creditComp,p->date2.pasComp,p->date2.termComp);
            printf("\t体育 \t%d\t\t%s\t\t%s\t\t%d\n",p->date2.scoreSport,p->date2.creditSport,p->date2.pasSport,p->date2.termSport);
            printf("\t马原 \t%d\t\t%s\t\t%s\t\t%d\n",p->date2.scoreChinese,p->date2.creditChinese,p->date2.pasChinese,p->date2.termChinese);
            p=p->next;
            printf("-----------------------------------------------------------------------------\n");
        }
    }
    //打印链表,指针不指向下一个
    void displayNode1(Link p)
    {
            printf("----------------------------------------------\n");
            printf("\t  \t学号\t\t姓名\t\t性别\t\t年龄\n");
            printf("\t  \t%s\t\t%s\t\t%s\t\t%d\n", p->date1.studentNo, p->date1.studentName,p->date1.studentSex,p->date1.studentAge);
            printf("\t  \t成绩\t\t学分\t\t方式\t\t学期\n");
            printf("\t数学 \t%d\t\t%s\t\t%s\t\t%d\n",p->date2.scoreMath,p->date2.creditMath,p->date2.pasMath,p->date2.termMath);
            printf("\t英语 \t%d\t\t%s\t\t%s\t\t%d\n",p->date2.scoreEgls,p->date2.creditEgls,p->date2.pasEgls,p->date2.termEgls);
            printf("\t计算机\t%d\t\t%s\t\t%s\t\t%d\n",p->date2.scoreComp,p->date2.creditComp,p->date2.pasComp,p->date2.termComp);
            printf("\t体育 \t%d\t\t%s\t\t%s\t\t%d\n",p->date2.scoreSport,p->date2.creditSport,p->date2.pasSport,p->date2.termSport);
            printf("\t马原 \t%d\t\t%s\t\t%s\t\t%d\n",p->date2.scoreChinese,p->date2.creditChinese,p->date2.pasChinese,p->date2.termChinese);
            printf("----------------------------------------------\n");
        }
    
    //按照给定的学号查询学生记录,找到返回true,没有找到返回false
    bool queryNode(Link head)
    {
        char no[NO_LENGTH],nam[NAME_LENGTH];
        int select;
        Link p = head->next;
        printf("1.学号\t2.姓名\t\n");
        printf("请输入想要查询的项目:");
        scanf("%d",&select);
        switch(select)
        {
         case 1:
               inputStudentNo("查询",no);
               while (p!= NULL)
               {
                 if (strcmp(p->date1.studentNo,no) == 0)
                {
                     displayNode1(p);
                     return true;
                }
                else
                {
                     p=p->next;
                }
               }
                break;
        case 2:
            inputStudentName("查询",nam);
             while (p!=NULL)
               {
                 if (strcmp(p->date1.studentName,nam)==0)
                {
                     displayNode1(p);
                     return true;
                }
                else
                {
                     p=p->next;
                }
               }
                break;
        default:
            printf("输入不正确,请输入1-2之间的数。\n");
          break;
        }
        return false;
    }
    
    //修改学生记录,修改成功,返回true,否则返回false
    bool modifyNode(Link head)
    {
        char no[NO_LENGTH];
        char no_new[NO_LENGTH];     //新学号
        char name_new[NAME_LENGTH]; //新姓名
        int select;                 //功能选择
        Link p, q;
    
        inputStudentNo("修改", no);
        printf("请输入需要修改的项目: 1 学号 2 姓名\n");
        scanf("%d",&select);
    
        p=head;
        q=head->next;
        while (q!=NULL)
        {
            if (strcmp(q->date1.studentNo,no)==0)
            {
                if (select==1)
                {
                    p->next=q->next;
                    q->next=NULL;
                    printf("请输入该学生的新学号:");
                    scanf("%s",no_new);
                    strcpy(q->date1.studentNo,no_new);
                    insertNode(head,q);
                }
                else
                {
                    printf("请输入该学生的新姓名:");
                    scanf("%s",name_new);
                    strcpy(q->date1.studentName,name_new);
                }
                return true;
            }
            else
            {
                p=q;
                q=q->next;
            }
        }
    
        return false;
    }
    
    //插入一个学生记录
    void insertNode(Link head, Link newNode)
    {
        Link p,q;
        bool flag=false; //是否插入成功
    
        p=head;//做标记
        q=head->next;//用作比较
        //如果是空链表
        if(head->next==NULL)
        {
            head->next=newNode;
            flag=true;
        }
        else
        {
            //不是空链表
            while (q!=NULL)
            {
                if (strcmp(newNode->date1.studentNo, q->date1.studentNo) < 0)
                {
                    p->next=newNode;
                    newNode->next=q;
                    flag=true;
                    break;
                }
                else
                {
                    p=q;
                    q=q->next;
                }
            }
        }
            if(q==NULL&&flag==false)
        {
            p->next=newNode;
            flag=true;
        }
    }
    
    //统计学生人数
    int countNode(Link head)
    {
        Link p;
        int count=0;
        p=head->next;
        while (p!= NULL)
        {
            count++;
            p=p->next;
        }
    
        return count;
    }
    
    //清除链表
    void clearLink(Link head)
    {
        Link p,q;
    
        p=head;
        q=head->next;
    
        while (q!=NULL)
        {
            free(p);
            p=q;
            q=q->next;
        }
        free(p);
    }
    
    //成绩统计
    void statisticsNode(Node *head)
    {
        typedef struct student
        {
          char name[20];//姓名
          int sum;//总分
          float aver;//平均分
          float credit;//学分
        }student;
        student stu[20],buf;
        int i,n=0,q,w,select;
        int maxM=0,maxE=0,maxC=0,maxS=0,maxCH=0;
        int sumM=0,sumE=0,sumC=0,sumS=0,sumCH=0;
        float aveM,aveE,aveC,aveS,aveCH;
        float numM[20],numE[20],numC[20],numS[20],numCH[20];
        Node *p;
        p=head->next;
        i=countNode(head);
        printf("\t总共%d个学生\n",i);
        printf("\t姓名\t总分\t平均分\t学分绩点\n");
        while (p)
        {
            //将char类型的学分转换成浮点型float
            numM[n]=atof(p->date2.creditMath);
            numE[n]=atof(p->date2.creditEgls);
            numC[n]=atof(p->date2.creditComp);
            numS[n]=atof(p->date2.creditSport);
            numCH[n]=atof(p->date2.creditChinese);
            strcpy(stu[n].name,&p->date1.studentName);
            stu[n].sum=p->date2.scoreMath+p->date2.scoreEgls+p->date2.scoreComp+p->date2.scoreSport+p->date2.scoreChinese;//计算总分
            stu[n].aver=stu[n].sum/5;//计算平均分
            stu[n].credit=(numM[n]+numE[n]+numC[n]+numS[n]+numCH[n])/5;//计算学分
            printf("\t%s\t%d\t%.2f\t%.2f\n",stu[n].name,stu[n].sum,stu[n].aver,stu[n].credit);
            p=p->next;//下一个结点
            n++;
        };
        printf("\t-------------排序后------------\n");
        printf("\t姓名\t总分\t平均分\t学分\n");
          for (q=0;q<n-1;++q)  //比较n-1轮
        {
            for (w=0;w<n-1-q;++w)  //每轮比较n-1-i次,
            {
                if (stu[w].sum<stu[w+1].sum)
                {
                    buf=stu[w];
                    stu[w]=stu[w+1];
                    stu[w+1]=buf;
                }
            }
        }
        for(n=0;n<i;n++)
        {
            printf("\t%s\t%d\t%.2f\t%.2f\n",stu[n].name,stu[n].sum,stu[n].aver,stu[n].credit);
        }
        printf("\t------------科目查询-----------\n");
        printf("\t1.数学\t2.英语 3.计算机\t4.体育\t5.马原\n");
        printf("\t请输入需要查询的科目序号:");
        scanf("%d",&select);
        p=head->next;
        switch(select)
        {
        case 1:
             while(p)
          {
            if(maxM<p->date2.scoreMath)
             {
                maxM=p->date2.scoreMath;
             }
            sumM=sumM+p->date2.scoreMath;
            p=p->next;
          }
          aveM=sumM/i;
          printf("\t数学最高分:%d\n",maxM);
          printf("\t数学平均分:%.2f\n",aveM);
         break;
    
         case 2:
              while(p)
          {
               if(maxE<p->date2.scoreEgls)
                {
                   maxE=p->date2.scoreEgls;
                }
             sumE=sumE+p->date2.scoreEgls;
             p=p->next;
          }
          aveE=sumE/i;//平均值
          printf("\t英语最高分:%d\n",maxE);
          printf("\t英语平均分:%.2f\n",aveE);
          break;
    
        case 3:
             while(p)
          {
              if(maxC<p->date2.scoreComp)
               {
                  maxC=p->date2.scoreComp;
               }
             sumC=sumC+p->date2.scoreComp;
             p=p->next;
          }
          aveC=sumC/i;
          printf("\t计算机最高分:%d\n",maxC);
          printf("\t计算机平均分:%.2f\n",aveC);
          break;
    
          case 4:
               while(p)
            {
               if(maxS<p->date2.scoreSport)
                {
                   maxS=p->date2.scoreSport;
                }
              sumS=sumS+p->date2.scoreSport;
              p=p->next;
            }
            aveS=sumS/i;
            printf("\t体育最高分:%d\n",maxS);
            printf("\t体育平均分:%.2f\n",aveS);
          break;
    
    
         case 5:
              while(p)
            {
                if(maxCH<p->date2.scoreChinese)
                 {
                    maxCH=p->date2.scoreChinese;
                 }
              sumCH=sumCH+p->date2.scoreChinese;
              p=p->next;
            }
            aveCH=sumCH/i;
            printf("\t马原最高分:%d\n",maxCH);
            printf("\t马原平均分:%.2f\n",aveCH);
          break;
         default:
            printf("\t输入不正确,请输入1-7之间的数。\n");
          break;
        }
    
    }
    //保存到文件
    void printfile(Link head)
    {
        FILE *fp;
        fp=fopen("chengji.txt","w");//打开文件
    
            fprintf(fp,"                    学生信息表\n");
    
        Link p=head->next;
        while (p!=NULL)
        {
            fprintf(fp,"----------------------------------------------\n");
            fprintf(fp,"\t  \t学号\t\t姓名\t\t性别\t\t年龄\n");
            fprintf(fp,"\t  \t%s\t\t%s\t\t%s\t\t%d\n", p->date1.studentNo, p->date1.studentName,p->date1.studentSex,p->date1.studentAge);
            fprintf(fp,"\t  \t成绩\t\t学分\t\t方式\t\t学期\n");
            fprintf(fp,"\t数学 \t%d\t\t%s\t\t%s\t\t%d\n",p->date2.scoreMath,p->date2.creditMath,p->date2.pasMath,p->date2.termMath);
            fprintf(fp,"\t英语 \t%d\t\t%s\t\t%s\t\t%d\n",p->date2.scoreEgls,p->date2.creditEgls,p->date2.pasEgls,p->date2.termEgls);
            fprintf(fp,"\t计算机\t%d\t\t%s\t\t%s\t\t%d\n",p->date2.scoreComp,p->date2.creditComp,p->date2.pasComp,p->date2.termComp);
            fprintf(fp,"\t体育 \t%d\t\t%s\t\t%s\t\t%d\n",p->date2.scoreSport,p->date2.creditSport,p->date2.pasSport,p->date2.termSport);
            fprintf(fp,"\t马原 \t%d\t\t%s\t\t%s\t\t%d\n",p->date2.scoreChinese,p->date2.creditChinese,p->date2.pasChinese,p->date2.termChinese);
            p=p->next;
            fprintf(fp,"----------------------------------------------\n");
        }
        fclose(fp);//关闭文件
        printf("\n\n*******************恭喜,保存完成!*******************\n\n");
    }
    
    `
    

    展开全文
  • 3)学生成绩管理系统  需要处理的基础数据 学生基本信息:如班级、学号、姓名、性别、年龄等。 学生选修课程的基本信息:课程编号、课程名称、学分、考试成绩、平时成绩、综合成绩(考试成绩*0.7+平时成绩*0.3...
  • 制作一个学籍管理系统:要求包含以下模块,模块用子函数完成1)输入若干条(20)条记录(包含学号,姓名,科目,科目成绩,学期学分)2)显示所有记录3)按学号排序4)插入一条记录5)查找并显示一条记录6)按姓名...

    /*****************************************************************************/

    /*

    制作一个学籍管理系统:要求包含以下模块,模块用子函数完成1)输入若干条(20)条记录(包含学号,姓名,科目,科目成绩,学期学分)2)显示所有记录3)按学号排序4)插入一条记录5)查找并显示一条记录6)按姓名查找并删除一条记录7)显示统计信息  PS:因为是初学,不要用指针,用函数的做法做吧~~别做的太高端了。

    学籍管理系统

    姓名:****              学校:湖南理工学院信息学院              专业:信息工程

     

                                                                                                                                                                                     */

    /*****************************************************************************/

     

     

    //姓名,学号,英语,语文,数学三种成绩

    #include <stdio.h>

    #include <stdlib.h>

    #include <windows.h>

    #define maxnumber 30

    int student_number;

    int count1=0,count2=0,Operate1=3;

    //FILE *stream;

    typedef struct stu{

             int idnumber;

             char name[20];

             double English_score;

             double chinese_score;

             double math_score;

    }Student;

    //按学号排序

     

     

    void putout_one(Student *sp)

    {

             for( int j=0;j<10;j++)

                       printf("******");

             printf("\n");

             printf("     %d    %s              %.1f %.1f         %.1f\n",(*sp).idnumber,(*sp).name,(*sp).English_score,(*sp).chinese_score,(*sp).math_score);

             for( j=0;j<10;j++)

                       printf("******");

             printf("\n");

    }

     

    void putout_lot(Student *student)

    {

             for(int i=0;i<=Operate1;i++)

             {

                       for(int j=0;j<10;j++)

                                printf("******");

                       printf("\n");

            

                       printf("     %d    %s              %.1f %.1f         %.1f\n",student[i].idnumber,student[i].name,student[i].English_score,student[i].chinese_score,student[i].math_score);

             }

             for( int j=0;j<10;j++)

                                printf("******");

                       printf("\n");

    }

     

    void input_student(Student *S)//输入插入学生的信息

    {

             //printf("请输入第%d位学生(学号,名字,语文,英语,数学)\n",i+1);

             scanf("%d",&(*S).idnumber);          

             scanf("%s",&(*S).name);

             scanf("%lf%lf%lf",&(*S).chinese_score,&(*S).English_score,&(*S).math_score);

    }

    void id_find_in(Student *S,Student *q)//把新的学生信息加入表单

    {

             Student *p=S,*t;

             while(count1<Operate1+1)

             {

                       t=p;

                       p++;

                       count1++;

             }

             *t=*q;

             count1=0;

             Operate1++;

    }

     

    void insert_element(Student *S)//插入学生信息

    {

             printf("请输入1位学生(学号,名字,语文,英语,数学)\n");

             Student *temp=(Student *)malloc(sizeof(Student)),*q=S;

             input_student(temp);

             id_find_in(S,temp);

    }

     

    void delet_element(Student *S,int id_n)

    {

             Student *p=S,*t;

             while(count1<Operate1)

             {

                       if((*p).idnumber==id_n)

                       {

                                t=p;

                                printf("已删除%d号学生信息\n",(*p).idnumber);

                                while(count2<Operate1-count1-1)

                                {

                                                   *(t-1)=*(++t);

                                                   count2++;

                                }

                                break;

                       }

                       count1++;

                       p++;

             }

             count1=0;

             count2=0;

             Operate1--;

    }

     

    int junge(char*a,char*b)

    {

             char *p=a,*q=b;

             while(*p!='\0')

             {

                       if(*p==*q)

                       {

                                p++;

                                q++;

                               

                                continue;

                       }

                       else

                                break;

             }

             if(*p=='\0'&&*q=='\0')

                       return 1;

             else

                       return 0;

    }

     

    void show_stu_element(Student*S,char*sp)//显示某人信息(功能已实现)

    {

             Student *p=S;

             while(count1<Operate1)

             {

                       if(junge((*p).name,sp))

                       {

                                printf("已找到此人:%s\n",(*p).name);

                                putout_one(p);

                                p=S;

                                break;

                       }

                       else

                       {                

                                p++;

                                count1++;

                                continue;

                       }

             }

             if(p!=S)

                       printf("查无此人!\n");

             count1=0;

    }

    void id_sort(Student *S)

    {

             Student *temp=(Student*)malloc(sizeof(Student)),*q=S,*t;

             int num=Operate1;

             while(count1<Operate1)

             {

                       t=q+1;     

                       while(count2<num)

                       {

                                if( (*q).idnumber> (*t).idnumber)

                                {

                                         *temp=*q;

                                         *q=*t;

                                         *(t)=*temp;

                                //      printf("%d\n",(*t).idnumber);

                                }

                                 

                                count2++;

                                t++;

                               

                       }

                       num--;

                       q++;

                       count2=0;

                       count1++;

                      

                       //q=q+sizeof(Student);

             }

             count1=0;

             count2=0;

    }

     

    void count_passnumber(Student *S)

    {

             Student *p=S;

             int e_p_number=0,m_p_number=0,c_p_number=0,num=0;

             while(num<=Operate1)

             {

                       if(p->English_score>=60)

                                e_p_number++;

                       if(p->math_score>=60)

                                m_p_number++;

                       if(p->chinese_score>=60)

                                c_p_number++;

                       num++;

                       p++;

             }

             printf("/***学生总人数=:%d\n",Operate1);

             printf("/***英语过关人数=%d       数学过关人数=%d 语文过关人数=%d\n",e_p_number,m_p_number,c_p_number);

             printf("/***英语挂科人数=%d       数学挂科人数=%d 语文挂科人数=%d\n",Operate1+1-e_p_number,Operate1+1-m_p_number,Operate1+1-c_p_number);//因为数组下标是从0开始的

    }

     

    void main()

    {

             Student student[maxnumber];

             //stream=freopen("in.txt","r",stdin);

             int Operate=3;int i;int id_n;

             char student_element[20];

             for(i=0;i<Operate1;i++)

             {

                       printf("请输入第%d位学生(学号,名字,语文,英语,数学)\n",i+1);

                       scanf("%d",&student[i].idnumber);                  

                       scanf("%s",&student[i].name);

                       scanf("%lf%lf%lf",&student[i].chinese_score,&student[i].English_score,&student[i].math_score);     

             }

             //fclose(stream);

             for( i=0;Operate!=0;i++)

             {

                       printf("输入:0.退出。\n1.输入学生信息\n2.按姓名查找并删除学生信息\n3.按学号排序\n4.查找显示一位学生信息     \n5.显示统计记录(成员数、每科平均分)\n6.输出每科及格人数和不及格人数\n7(default).操作完成,等待用户输入:\n");

                       scanf("%d",&Operate);

                       switch(Operate)

                       {

                       case 1:insert_element(student);     break;

                       case 2:      scanf("%d",&id_n);  delet_element(student,id_n);       break;

                       case 3:id_sort(student);break;

                       case 4:scanf("%s",student_element);  show_stu_element(student,student_element);break;

                       case 5:system(“cls”);  putout_lot(student);break;

                       case 6:count_passnumber(student);break;

                       default:    printf("请输入:\n");continue;

                       }

                       if(Operate==0)

                                break;

             }

    }

    加入了一个统计函数后的结果!

    ------------------------------------------------------------------------------------------------------2013年5月19日作

    展开全文
  • c语言学分管理程序

    2010-11-20 15:14:17
    fprintf(fp,"\n基础课 专业课 选修课 实验课 人文课(学分)\n"); fprintf(fp,"%15d%15d%15d%15d%15d\n",L.data[i].kch.jchk,L.data[i].kch.zhyk,L.data[i].kch.xxk, L.data[i].kch.shyk,L.data[i].kch....
  • C语言学籍管理系统

    千次阅读 2019-12-19 15:42:22
    C语言学籍管理系统学生成绩管理系统修改,并且进一步完善,修复了学生管理系统的许多bug。 需求 (1) 系统启动后,弹出一个用户界面,能实现人机交互的功能。而且只能通过界面菜单命令实现各种功能(包括系统...

    C语言学籍管理系统

    由学生成绩管理系统修改,并且进一步完善,修复了学生管理系统的许多bug。

    需求
    (1) 系统启动后,弹出一个用户界面,能实现人机交互的功能。而且只能通过界面菜单命令实现各种功能(包括系统退出功能),可以设计欢迎词。
    (2) 学生基本信息录入:录入信息包括学号、姓名、性别、宿舍号、电话号码等。
    (3) 学生成绩基本信息录入: 学号、课程编号、课程名称、学分、平时成绩、实验成绩、卷面成绩。
    (4) 计算综合成绩:若本课程无实验(如实验成绩为-1),综合成绩=平时成绩30% +卷面成绩70%;若本课程有实验(如实验成绩不为-1),综合成绩=平时成绩15%+实验成绩15%+卷面成绩*70%。
    (5) 计算实得学分:采用等级学分制。综合成绩在90—100分之间,实得学分=学分x100%;综合成绩在80—90分之间,实得学分=学分x80%;综合成绩在70—80分之间,实得学分=学分x75%;综合成绩在60—70分之间,实得学分=学分x60%;综合成绩在60分以下,实得学分=学分x0%;
    (6) 学生基本情况的查询并输出:输入一个学生的学号或姓名,可查询出此学生的基本信息并显示输出;输入一个宿舍号码,可查询出本宿舍所有学生的基本信息并显示输出。
    (7) 学生成绩信息的查询并输出:输入一个学生的学号或姓名,可查询出此学生的所有课程情况。(如输出:学号,姓名,课程编号,课程姓名,综合成绩,实得学分等,并统计学生共修课程数目以及实得总学分值。)
    (8) 排序(分别按综合成绩和实得学分),输出按照综合成绩(或实得学分)升序或降序排序后的学生信息以及对应的课程成绩信息(或实得学分信息)。
    (9) 成绩修改:查找后修改成绩,修改后按照综合成绩重新排序,并输出学生信息和对应课程成绩和综合成绩。
    (10) 成绩追加:增补遗漏的学生以及对应的信息和对应的课程成绩,并计算出综合成绩和实得学分,增补以后重新排序,并输出新增学生信息和对应课程成绩和综合成绩。

    附加功能
    (11) 删除学生信息:删除不需要的学生对应的记录(包括姓名、学号、课程、成绩等)。
    (12) 成绩(学分)分段:将学生成绩(学分)分段。
    (13) 文件存储:把学生信息和对应的课程成绩信息存入到文件中。
    (14) 文件输出:输出文件中的内容。
    (15) 文件导入:从文件中导入数据到学籍管理系统中,然后进行管理。

    代码

    #include <stdio.h>
    #include <windows.h> 
    #include <stdlib.h>
    #include <string.h>
    #pragma warning(disable : 4996)//关闭编译器报错
    struct basic//基础信息
    {
    	char id[30],name[10],sex[5],dom[5], tel[20];
    };
    
    struct sco//基本成绩
    {
    	struct chinese//语文
    	{
    		char credit[5], daily[5], experi[5],paper[5];
    		float overal=0, real_credit=0;
    		bool has=false;
    	}ch;
    	struct math//数学
    	{
    		char credit[5], daily[5], experi[5], paper[5];
    		float overal=0, real_credit=0;
    		bool has=false;
    	}ma;
    	struct english//英语
    	{
    		char credit[5], daily[5], experi[5], paper[5];
    		float overal=0, real_credit=0;
    		bool has=false;
    	}en;
    	struct pysicalexercise//体育
    	{
    		char credit[5], daily[5], experi[5], paper[5];
    		float overal=0, real_credit=0;
    		bool has=false;
    	}pe;
    	struct softwareeng//专业
    	{
    		char credit[5], daily[5], experi[5], paper[5];
    		float overal=0, real_credit=0;
    		bool has=false;
    	}se;
    	float overal_aver=0,credit_aver=0;
    };
    
    struct student//学生结构
    {
    	struct basic basic;//包含基础信息
    	struct sco sco;//包含基本成绩
    };
    void Paint_Start();//绘制开始菜单
    void insert_score();//成绩录入
    void insert_info();//信息录入
    void insert_File();//文件导入
    void list();//排序输出
    void find_info();//查找信息
    void find_score();//查询成绩
    void add();//添加条目
    void del();//删除成绩
    void savefile();//保存到文件,假保存,真效果
    void outfile();//输出文件里的学生信息和成绩
    void edit();//更改成绩,查找出来,再进行修改
    void div();//成绩分段,分三段,我随意
    
    void end();//结束动画
    int ifnum(char item[]);//用来在各模块中输入数字时,判断是不是数字
    int main()
    {
    	system("color 02");//先打印个郑州轻工业大学图标纪念一下
    	printf("\n\n\n\n\n\t\t\t\t\t                 *\n");
    	printf("\t\t\t\t\t            *  ***  ****\n");
    	printf("\t\t\t\t\t          *** **** ****\n");
    	printf("\t\t\t\t\t         **** **** **** ****\n");
    	printf("\t\t\t\t\t         **** **** **** ****\n");
    	printf("\t\t\t\t\t         **** **** **** ****\n");
    	printf("\t\t\t\t\t         **** **** **** ****\n");
    	printf("\t\t\t\t\t         **** **** **** ****\n");
    	printf("\t\t\t\t\t          **** ******* ****\n");
    	printf("\t\t\t\t\t            *************\n");
    	printf("\t\t\t\t\t                *****\n\n");
    	printf("\t\t\t\t\t         欢迎使用学籍管理系统\n");
    	printf("\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t\t    ");
    	system("pause");
    	Paint_Start();//打印开始菜单,进入功能选择
    	return 0;
    } 
    //绘制菜单
    void Paint_Start()
    {
    	system("cls");
    	printf("***********************************************************************************************************************\n");
    	printf("*\t\t\t\t\t\t   学籍管理系统\t\t\t\t\t\t\t      *\n");
    	printf("*\t\t1.信息录入\t\t2.成绩录入\t\t3.信息查询\t\t4.成绩查询\t\t      *\n");
    	printf("*\t\t5.排序查看\t\t6.成绩修改\t\t7.成绩追加\t\t8.删除数据\t\t      *\n");
    	printf("*\t\t9.成绩分段\t\t10.文件储存\t\t11.文件输出\t\t12.文件导入\t\t      *\n");
    	printf("***********************************************************************************************************************\n\t\t\t\t\t\t <输入0炫酷退出>\n");
    	printf("执行编号:");
    	int num;//储存功能编号
    	scanf("%d", &num);//接收编号,准备判断需求
    	while (getchar() != '\n')continue;//忽略多余输入,类似清空缓冲区
    	switch (num)//选择功能
    	{
    		case 0:end(); break;
    		case 1:insert_info(); break;//信息录入
    		case 2:insert_score(); break;//成绩录入
    		case 3:find_info(); break;//信息查询
    		case 4:find_score(); break;//成绩查询
    		case 5:list(); break;//输出排序
    		case 6:edit(); break;//修改成绩
    		case 7:add(); break;//成绩和信息的追加
    		case 8:del(); break;//删除数据
    		case 9:div(); break;//成绩分段
    		case 10:savefile(); break;//储存文件
    		case 11:outfile(); break;//输出文件的内容
    		case 12:insert_File(); break;//导入文件的内容到数据库
    		default:printf("请选择对应的序号!"); system("pause"); Paint_Start();
    	}
    }
    //录入成绩
    void insert_score()
    {
    	system("cls");
    	printf("\n\n\n\n\n\n\n\n\n\n\t\t\t\t    注意:请输入对应的正确内容,否则记录将出现错误!\n\n\t\t\t\t\t\t  ");//提示一下用户
    	system("pause");
    	system("cls");
    	printf("*****************************************************成绩录入***********************************************************\n");
    	printf("依次键入学号、课程编号(A-E)、课程名称(以编号为准)、学分、平时成绩、实验成绩、卷面成绩,用一个空格隔开各数据,每一条输入完成后按回车键进行下一条输入。\n\t\t\t\t\t\t<输入'#'并回车退出>\n例如:\n541913460230 A 语文 3 66 78 82\n");
    	printf("在此输入:\n");
    	student stu;
    	char id[30],subid[5],subname[10],daily[5],credit[5],experi[5],paper[5];//定义变量储存输入值,用于判断,无错误则将其赋值给stu对应变量,最后把stu结构体写入文件
    	bool err;
    	FILE* fp;
    	fp = fopen("stu.db", "rb+");//读写
    	if (fp == NULL)
    	{
    		printf("文件打开失败!\n");
    		system("pause");
    		Paint_Start();
    	}
    	while (1)
    	{
    		err = false;//错误标记变量,初始为无错
    		memset(id,0,30);//清空各数组所占内存的内容,都变成空,方便后续判断
    		memset(subid,0,5);
    		memset(subname,0,10);
    		memset(credit,0,5);
    		memset(daily,0,5);
    		memset(experi,0,5);
    		memset(paper, 0, 5);//这样以后,所有元素都变成\0了
    		scanf("%s",id);
    		if (id[0] == '#')
    		{
    			fcloseall();
    			break;
    		}
    		scanf(" %s %s %s %s %s %s", subid, subname, credit, daily, experi, paper);
    		while (getchar() != '\n')continue;
    
    		if (ifnum(id) && id[11] != '\0' && id[12] == '\0');//是否是数字,是否符合12位数
    		else
    		{
    			printf("请检查学号输入是否正确,并重新输入!\n");
    			err = true;//若出错,则错误标记改为 错
    		}
    		if (subid[0] >= 'A' && subid[0] <= 'E' && subid[1] == '\0');//是否是数字,是否有效实际
    		else
    		{
    			printf("请检查课程编号输入是否正确,并重新输入!\n");
    			err = true;
    		}
    		if (ifnum(credit));
    		else
    		{
    			printf("请检查学分输入是否正确,并重新输入!\n");
    			err = true;
    		}
    		if (ifnum(daily) && ((daily[0] == '1' && daily[1] == '0' && daily[2] == '0') || (daily[2] == '\0' && daily[3] != '\0') || daily[2] == '\0'));
    		else
    		{
    			printf("请检查平时成绩输入是否正确,并重新输入!\n");
    			err = true;
    		}
    		if (ifnum(experi) && ((experi[0] == '1' && experi[1] == '0' && experi[2] == '0') || (experi[2] == '\0' && experi[3] != '\0') || experi[2] == '\0'));
    		else
    		{
    			printf("请检查实验成绩输入是否正确,并重新输入!\n");
    			err = true;
    		}
    		if (ifnum(paper) && ((paper[0] == '1' && paper[1] == '0' && paper[2] == '0') || (paper[2] == '\0' && paper[3] != '\0') || paper[2] == '\0'));
    		else
    		{
    			printf("请检查卷面成绩输入是否正确,并重新输入!\n");
    			err = true;
    		}
    		if (err == false)
    		{
    			//此处写入磁盘文件
    			int exist = 0;//是否存在同一个人的标记变量,用于查重标记
    			while (fgetc(fp) != EOF)
    			{
    				fseek(fp, -1L, 1);
    				fread(&stu, 240, 1, fp);
    				if (strcmp(stu.basic.id, id) == 0)//对比学号是否一样
    				{
    					exist = 1;//存在此人
    					switch (subid[0])//根据录入的科目编号将各项成绩信息计算并存入stu结构体
    					{
    					case 'A':
    					{
    						stu.sco.ch.has = true;
    						strcpy(stu.sco.ch.credit, credit);
    						strcpy(stu.sco.ch.daily, daily);
    						strcpy(stu.sco.ch.experi, experi);
    						strcpy(stu.sco.ch.paper, paper);
    						float credittemp;
    						if (credit[2] == '0') credittemp = 100;
    						else if (credit[1] != '\0')
    							credittemp = ((int)credit[0] - 48) * 10 + (int)credit[1] - 48;
    						else credittemp = (int)credit[0] - 48;
    						float dailytemp, papertemp, experitemp;
    						if (daily[2] == '0') dailytemp = 100;
    						else if (daily[1] != '\0')
    							dailytemp = ((int)daily[0] - 48) * 10 + (int)daily[1] - 48;
    						else dailytemp = (int)daily[0] - 48;
    						if (paper[2] == '0') papertemp = 100;
    						else if (paper[1] != '\0')
    							papertemp = ((int)paper[0] - 48) * 10 + (int)paper[1] - 48;
    						else papertemp = (int)paper[0] - 48;
    						if (strcmp(experi, "-1") == 0)
    						{
    							stu.sco.ch.overal = dailytemp * 0.3 + papertemp * 0.7;
    						}
    						else
    						{
    							if (experi[2] == '0') experitemp = 100;
    							else if (experi[1] != '\0')
    								experitemp = ((int)experi[0] - 48) * 10 + (int)experi[1] - 48;
    							else experitemp = (int)experi[0] - 48;
    							stu.sco.ch.overal = dailytemp * 0.15 + experitemp * 0.15 + papertemp * 0.7;
    						}
    						if (stu.sco.ch.overal >= 90 && stu.sco.ch.overal <= 100)
    							stu.sco.ch.real_credit = credittemp;
    						else if (stu.sco.ch.overal < 90 && stu.sco.ch.overal >= 80) stu.sco.ch.real_credit = credittemp * 0.8;
    						else if (stu.sco.ch.overal < 80 && stu.sco.ch.overal >= 70) stu.sco.ch.real_credit = credittemp * 0.75;
    						else if (stu.sco.ch.overal < 70 && stu.sco.ch.overal >= 60) stu.sco.ch.real_credit = credittemp * 0.6;
    						else stu.sco.ch.real_credit = 0;
    					}; break;
    					case 'B':
    					{
    						stu.sco.ma.has = true;
    						strcpy(stu.sco.ma.credit, credit);
    						strcpy(stu.sco.ma.daily, daily);
    						strcpy(stu.sco.ma.experi, experi);
    						strcpy(stu.sco.ma.paper, paper);
    						float credittemp;
    						if (credit[2] == '0') credittemp = 100;
    						else if (credit[1] != '\0')
    							credittemp = ((int)credit[0] - 48) * 10 + (int)credit[1] - 48;
    						else credittemp = (int)credit[0] - 48;
    						float dailytemp, papertemp, experitemp;
    						if (daily[2] == '0') dailytemp = 100;
    						else if (daily[1] != '\0')
    							dailytemp = ((int)daily[0] - 48) * 10 + (int)daily[1] - 48;
    						else dailytemp = (int)daily[0] - 48;
    						if (paper[2] == '0') papertemp = 100;
    						else if (paper[1] != '\0')
    							papertemp = ((int)paper[0] - 48) * 10 + (int)paper[1] - 48;
    						else papertemp = (int)paper[0] - 48;
    						if (strcmp(experi, "-1") == 0)
    						{
    							stu.sco.ma.overal = dailytemp * 0.3 + papertemp * 0.7;
    						}
    						else
    						{
    							if (experi[2] == '0') experitemp = 100;
    							else if (experi[1] != '\0')
    								experitemp = ((int)experi[0] - 48) * 10 + (int)experi[1] - 48;
    							else experitemp = (int)experi[0] - 48;
    							stu.sco.ma.overal = dailytemp * 0.15 + experitemp * 0.15 + papertemp * 0.7;
    						}
    						if (stu.sco.ma.overal >= 90 && stu.sco.ma.overal <= 100)
    							stu.sco.ma.real_credit = credittemp;
    						else if (stu.sco.ma.overal < 90 && stu.sco.ma.overal >= 80) stu.sco.ma.real_credit = credittemp * 0.8;
    						else if (stu.sco.ma.overal < 80 && stu.sco.ma.overal >= 70) stu.sco.ma.real_credit = credittemp * 0.75;
    						else if (stu.sco.ma.overal < 70 && stu.sco.ma.overal >= 60) stu.sco.ma.real_credit = credittemp * 0.6;
    						else stu.sco.ma.real_credit = 0;
    					}; break;
    					case 'C':
    					{
    						stu.sco.en.has = true;
    						strcpy(stu.sco.en.credit, credit);
    						strcpy(stu.sco.en.daily, daily);
    						strcpy(stu.sco.en.experi, experi);
    						strcpy(stu.sco.en.paper, paper);
    						float credittemp;
    						if (credit[2] == '0') credittemp = 100;
    						else if (credit[1] != '\0')
    							credittemp = ((int)credit[0] - 48) * 10 + (int)credit[1] - 48;
    						else credittemp = (int)credit[0] - 48;
    						float dailytemp, papertemp, experitemp;
    						if (daily[2] == '0') dailytemp = 100;
    						else if (daily[1] != '\0')
    							dailytemp = ((int)daily[0] - 48) * 10 + (int)daily[1] - 48;
    						else dailytemp = (int)daily[0] - 48;
    						if (paper[2] == '0') papertemp = 100;
    						else if (paper[1] != '\0')
    							papertemp = ((int)paper[0] - 48) * 10 + (int)paper[1] - 48;
    						else papertemp = (int)paper[0] - 48;
    						if (strcmp(experi, "-1") == 0)
    						{
    							stu.sco.en.overal = dailytemp * 0.3 + papertemp * 0.7;
    						}
    						else
    						{
    							if (experi[2] == '0') experitemp = 100;
    							else if (experi[1] != '\0')
    								experitemp = ((int)experi[0] - 48) * 10 + (int)experi[1] - 48;
    							else experitemp = (int)experi[0] - 48;
    							stu.sco.en.overal = dailytemp * 0.15 + experitemp * 0.15 + papertemp * 0.7;
    						}
    						if (stu.sco.en.overal >= 90 && stu.sco.en.overal <= 100)
    							stu.sco.en.real_credit = credittemp;
    						else if (stu.sco.en.overal < 90 && stu.sco.en.overal >= 80) stu.sco.en.real_credit = credittemp * 0.8;
    						else if (stu.sco.en.overal < 80 && stu.sco.en.overal >= 70) stu.sco.en.real_credit = credittemp * 0.75;
    						else if (stu.sco.en.overal < 70 && stu.sco.en.overal >= 60) stu.sco.en.real_credit = credittemp * 0.6;
    						else stu.sco.en.real_credit = 0;
    					}; break;
    					case 'D':
    					{
    						stu.sco.pe.has = true;
    						strcpy(stu.sco.pe.credit, credit);
    						strcpy(stu.sco.pe.daily, daily);
    						strcpy(stu.sco.pe.experi, experi);
    						strcpy(stu.sco.pe.paper, paper);
    						float credittemp;
    						if (credit[2] == '0') credittemp = 100;
    						else if (credit[1] != '\0')
    							credittemp = ((int)credit[0] - 48) * 10 + (int)credit[1] - 48;
    						else credittemp = (int)credit[0] - 48;
    						float dailytemp, papertemp, experitemp;
    						if (daily[2] == '0') dailytemp = 100;
    						else if (daily[1] != '\0')
    							dailytemp = ((int)daily[0] - 48) * 10 + (int)daily[1] - 48;
    						else dailytemp = (int)daily[0] - 48;
    						if (paper[2] == '0') papertemp = 100;
    						else if (paper[1] != '\0')
    							papertemp = ((int)paper[0] - 48) * 10 + (int)paper[1] - 48;
    						else papertemp = (int)paper[0] - 48;
    						if (strcmp(experi, "-1") == 0)
    						{
    							stu.sco.pe.overal = dailytemp * 0.3 + papertemp * 0.7;
    						}
    						else
    						{
    							if (experi[2] == '0') experitemp = 100;
    							else if (experi[1] != '\0')
    								experitemp = ((int)experi[0] - 48) * 10 + (int)experi[1] - 48;
    							else experitemp = (int)experi[0] - 48;
    							stu.sco.pe.overal = dailytemp * 0.15 + experitemp * 0.15 + papertemp * 0.7;
    						}
    						if (stu.sco.pe.overal >= 90 && stu.sco.pe.overal <= 100)
    							stu.sco.pe.real_credit = credittemp;
    						else if (stu.sco.pe.overal < 90 && stu.sco.pe.overal >= 80) stu.sco.pe.real_credit = credittemp * 0.8;
    						else if (stu.sco.pe.overal < 80 && stu.sco.pe.overal >= 70) stu.sco.pe.real_credit = credittemp * 0.75;
    						else if (stu.sco.pe.overal < 70 && stu.sco.pe.overal >= 60) stu.sco.pe.real_credit = credittemp * 0.6;
    						else stu.sco.pe.real_credit = 0;
    					}; break;
    					case 'E':
    					{
    						stu.sco.se.has = true;
    						strcpy(stu.sco.se.credit, credit);
    						strcpy(stu.sco.se.daily, daily);
    						strcpy(stu.sco.se.experi, experi);
    						strcpy(stu.sco.se.paper, paper);
    						float credittemp;
    						if (credit[2] == '0') credittemp = 100;
    						else if (credit[1] != '\0')
    							credittemp = ((int)credit[0] - 48) * 10 + (int)credit[1] - 48;
    						else credittemp = (int)credit[0] - 48;
    						float dailytemp, papertemp, experitemp;
    						if (daily[2] == '0') dailytemp = 100;
    						else if (daily[1] != '\0')
    							dailytemp = ((int)daily[0] - 48) * 10 + (int)daily[1] - 48;
    						else dailytemp = (int)daily[0] - 48;
    						if (paper[2] == '0') papertemp = 100;
    						else if (paper[1] != '\0')
    							papertemp = ((int)paper[0] - 48) * 10 + (int)paper[1] - 48;
    						else papertemp = (int)paper[0] - 48;
    						if (strcmp(experi, "-1") == 0)
    						{
    							stu.sco.se.overal = dailytemp * 0.3 + papertemp * 0.7;
    						}
    						else
    						{
    							if (experi[2] == '0') experitemp = 100;
    							else if (experi[1] != '\0')
    								experitemp = ((int)experi[0] - 48) * 10 + (int)experi[1] - 48;
    							else experitemp = (int)experi[0] - 48;
    							stu.sco.se.overal = dailytemp * 0.15 + experitemp * 0.15 + papertemp * 0.7;
    						}
    						if (stu.sco.se.overal >= 90 && stu.sco.se.overal <= 100)
    							stu.sco.se.real_credit = credittemp;
    						else if (stu.sco.se.overal < 90 && stu.sco.se.overal >= 80) stu.sco.se.real_credit = credittemp * 0.8;
    						else if (stu.sco.se.overal < 80 && stu.sco.se.overal >= 70) stu.sco.se.real_credit = credittemp * 0.75;
    						else if (stu.sco.se.overal < 70 && stu.sco.se.overal >= 60) stu.sco.se.real_credit = credittemp * 0.6;
    						else stu.sco.se.real_credit = 0;
    					}
    					//已经全部存入stu
    					}
    					fseek(fp, -240L, 1);
    					fwrite(&stu, 240, 1, fp);
    					break;
    				}
    			}
    			if (exist == 0) printf("查无此人,请先录入该学生基本信息!\n");
    			rewind(fp);
    		}
    	}
    	fcloseall();
    	Paint_Start();
    	return;
    }
    void insert_info()
    {
    	system("cls");
    	printf("\n\n\n\n\n\n\n\n\n\n\t\t\t\t    注意:请输入对应的正确内容,否则记录将出现错误!\n\n\t\t\t\t\t\t  ");
    	system("pause");
    	system("cls");
    	printf("*****************************************************信息录入***********************************************************\n");
    	printf("依次键入学号、姓名、性别、宿舍号码、电话号码,用一个空格隔开各数据,每一条输入完成后按回车键进行下一条输入。\n\t\t\t\t\t\t退出(输入'#'并回车)\n样例:\n541913460230 喵辰汐 男 113 10086\n");
    	printf("在此输入:\n");
    	FILE* fp;
    	student stu;
    	bool err;
    	char id[30], name[10], sex[5]="", dom[5], tel[20];
    	while (true)
    	{
    		err = false;
    		fp = fopen("stu.db", "rb+");
    		if (fp == NULL)
    		{
    			fp = fopen("stu.db", "wb");
    			fclose(fp);
    			fp = fopen("stu.db", "rb+");
    		}
    		memset(id,0,30);
    		memset(name, 0, 10);
    		memset(sex, 0, 5);
    		memset(dom, 0, 5);
    		memset(tel, 0, 20);
    		scanf("%s",id);
    		if (id[0] == '#')
    		{
    			fclose(fp);
    			break;
    		}
    		scanf(" %s %s %s %s",name,sex,dom,tel);
    		while (getchar() != '\n')continue;
    		bool isname = true;
    		for (int i = 0; i <= 7; i++)
    		{
    			if (name[i] >= 32 && name[i] <= 127) isname = false;//仅判断是否是ASCII中的字符
    		}
    		if (name[8] == '\0' && isname == true)//一个中文字符占两个字节
    		{
    			strcpy(stu.basic.name, name);
    		}
    		else
    		{
    			printf("请检查姓名输入是否正确,并重新输入!\n");
    			err = true;
    		}
    
    		if (ifnum(id) && id[11] != '\0' && id[12] == '\0') strcpy(stu.basic.id, id);
    		else
    		{
    			printf("请检查学号输入是否正确,并重新输入!\n");
    			err = true;
    		}
    		if (strcmp(sex, "男") == 0 || strcmp(sex, "女") == 0) strcpy(stu.basic.sex, sex);
    		else
    		{
    			printf("请检查性别输入是否正确,并重新输入!\n");
    			err = true;
    		}
    		if (ifnum(dom)) strcpy(stu.basic.dom, dom);
    		else
    		{
    			printf("请检查宿舍号码输入是否正确,并重新输入!\n");
    			err = true;
    		}
    		if (ifnum(tel)) strcpy(stu.basic.tel, tel);
    		else
    		{
    			printf("请检查电话号码输入是否正确,并重新输入!\n");
    			err = true;
    		}
    		if (err == false)
    		{
    			int exist=0;
    			student _stu=stu;
    			while (fgetc(fp) != EOF)//遍历
    			{
    				fseek(fp, -1L, 1);
    				fread(&_stu, 240, 1, fp);
    				if (strcmp(_stu.basic.id, id) == 0)//找到相同项
    				{
    					exist = 1;
    					printf("已有此人!\n");
    					break;
    				}
    			}
    			if (exist == 0)//文件指针已在末尾
    			{
    				fwrite(&stu, 240, 1, fp);//写入文件
    			}
    		}
    		fclose(fp);
    	}
    	Paint_Start();
    }
    void insert_File()//文件导入
    {
    	char dir[50] = "";//存放 导入的文件的绝对路径的 字符串变量
    	FILE* fp,*fpp;
    	student stu;
    	printf("输入文件的绝对路径(例如C:\\abc123.db):\n");
    	scanf("%s", dir);//输入绝对路径
    	while (getchar() != '\n')continue;//忽略多余输入
    	if ((fpp = fopen("stu.db", "ab")) == NULL)//以二进制追加方式打开数据库文件
    	{
    		printf("数据库打开失败!\n");
    		system("pause");
    		Paint_Start();
    		return;
    	}
    	if (fpp == NULL)
    	{
    		fpp = fopen("stu.db", "wb");
    		fclose(fpp);
    		fpp = fopen("stu.db","ab");
    	}
    	if ((fp = fopen(dir, "rb"))==NULL)//以二进制只读方式打开要导入的文件
    	{
    		printf("所选文件打开失败!");
    		system("pause");
    		Paint_Start();
    		return;
    	}
    	for (; fgetc(fp) != EOF;)//fp的文件位置往后读一字节看是不是读到EOF了,不是就再退一字节
    	{
    		fseek(fp,-1L,1);//fp位置退一字节
    		fread(&stu, 240, 1, fp);
    		fwrite(&stu, 240, 1, fpp);
    	}
    	printf("导入完成!");
    	system("pause");
    	fcloseall();
    	Paint_Start();
    }
    void list()//排序查看
    {
    	FILE* fp;
    	student stu;
    	student* _stu = (student*) malloc(240 * 50);//临时数组用于储存读取的所有人数据,用来排序而不改变文件内容
    	int num, i;
    	fp = fopen("stu.db", "rb");//只读
    	system("cls");
    	printf("*****************************************************排序输出***********************************************************\n");
    	printf("选择排序的选项,综合成绩(输入1),实得学分(输入2),按Enter键确认:\n");
    	if (fp == NULL)
    	{
    		printf("数据文件打开失败!\n");
    		system("pause");
    		Paint_Start();
    		return;
    	}
    	for (i = 0; fgetc(fp) != EOF; i++)//计算学生数量
    	{
    		fseek(fp, -1L, 1);
    		if (fread(&_stu[i], 240, 1, fp) != 1)
    		{
    			printf("数据读取失败!\n");
    			system("pause");
    			fclose(fp);
    			Paint_Start();
    			return;
    		}
    	}
    	for (int j=0; j<i;j++)//计算每个同学的平均成绩
    	{
    		_stu[j].sco.overal_aver = (_stu[j].sco.ch.overal + _stu[j].sco.ma.overal + _stu[j].sco.en.overal + _stu[j].sco.pe.overal + _stu[j].sco.se.overal) / 5.0;//平均综合成绩
    		_stu[j].sco.credit_aver = (_stu[j].sco.ch.real_credit + _stu[j].sco.ma.real_credit + _stu[j].sco.en.real_credit + _stu[j].sco.pe.real_credit + _stu[j].sco.se.real_credit) / 5.0;//平均综合学分
    	}
    	
    	scanf("%d", &num);
    	while (getchar() != '\n')continue;
    	if (num == 1)//按平均综合成绩排序
    	{
    		
    		for (int j = 0; j < i - 1; j++)//起泡法排序
    		{
    			for (int k = 0; k < i - 1 - j; k++)
    			{
    				if (_stu[k].sco.overal_aver < _stu[k + 1].sco.overal_aver)
    				{
    					student temp = _stu[k + 1];
    					_stu[k + 1] = _stu[k];
    					_stu[k] = temp;
    				}
    			}
    		}
    		printf("以下为各个学生信息和学生的各科综合成绩、平均综合成绩:\n\n");
    		printf("************************************************************************\n");
    		printf("* 学号           姓名      语文   数学   英语   体育   专业   平均综合 *\n");
    		for (int j = 0; j < i; j++)
    		{
    			printf("* %-15s%-10s%-7.1f%-7.1f%-7.1f%-7.1f%-7.1f%-9.2f*\n", _stu[j].basic.id, _stu[j].basic.name, _stu[j].sco.ch.overal, _stu[j].sco.ma.overal, _stu[j].sco.en.overal, _stu[j].sco.pe.overal, _stu[j].sco.se.overal,_stu[j].sco.overal_aver);
    		}
    		printf("************************************************************************\n");
    	}
    	else if (num == 2)//按平均实得学分排序
    	{
    		for (int j = 0; j < i - 1; j++)//起泡法排序
    		{
    			for (int k = 0; k < i - 1 - j; k++)
    			{
    				if (_stu[k].sco.credit_aver < _stu[k + 1].sco.credit_aver)
    				{
    					student temp = _stu[k + 1];
    					_stu[k + 1] = _stu[k];
    					_stu[k] = temp;
    				}
    			}
    		}
    		printf("以下为各个学生信息和学生的各科实得学分、平均实得学分:\n\n");
    		printf("************************************************************************\n");
    		printf("* 学号           姓名      语文   数学   英语   体育   专业   平均实得 *\n");
    		for (int j = 0; j < i; j++)
    		{
    			printf("* %-15s%-10s%-7.1f%-7.1f%-7.1f%-7.1f%-7.1f%-9.2f*\n", _stu[j].basic.id, _stu[j].basic.name,_stu[j].sco.ch.real_credit, _stu[j].sco.ma.real_credit, _stu[j].sco.en.real_credit, _stu[j].sco.pe.real_credit, _stu[j].sco.se.real_credit,_stu[j].sco.credit_aver);
    		}
    		printf("************************************************************************\n");
    	}
    	else
    	{
    		printf("二选一!");
    		system("pause");
    		Paint_Start();
    	}
    	free(_stu);//释放内存
    	fcloseall();
    	system("pause");
    	Paint_Start();
    }
    //查询信息
    void find_info()
    {
    	student stu;
    	int num;
    	char item[30]="";//用于储存姓名或者学号 跟数据库条目对比
    	FILE* fp;
    	fp = fopen("stu.db", "rb");//只读
    	if (fp == NULL)
    	{
    		printf("数据库打开失败!\n");
    		system("pause");
    		Paint_Start();
    		return;
    	}
    	printf("请选择查找方式,通过学号/姓名(输入1),宿舍号码(输入2)查找,按Enter键确认:\n");
    	scanf("%d",&num);//选择查找方式
    	while (getchar() != '\n')continue;
    	if (num == 1)//姓名或学号
    	{
    		printf("选择通过学号(输入1),姓名(输入2)查找,按Enter键确认:\n");
    		scanf("%d",&num);
    		while (getchar() != '\n')continue;
    		if (num == 1)//学号
    		{
    			printf("\t\t\t\t\t\t<键入'#'并回车退出>\n");
    			int exist;
    			while (1)
    			{
    				exist = 0;
    				printf("输入学号:");
    				scanf("%s", item);
    				while (getchar() != '\n')continue;
    				if (item[0] == '#')//#则退出
    				{
    					fclose(fp);
    					Paint_Start();
    				}
    				while (fgetc(fp) != EOF)//遍历
    				{
    					fseek(fp, -1L, 1);
    					fread(&stu, 240, 1, fp);
    					if (strcmp(stu.basic.id, item) == 0)//找到相同项就打印出来
    					{
    						exist = 1;
    						printf("%-15s%-10s%-5s%-10s%-15s\n", "学号", "姓名", "性别", "宿舍号码", "电话号码");
    						printf("%-15s%-10s%-5s%-10s%-15s\n\n", stu.basic.id, stu.basic.name, stu.basic.sex, stu.basic.dom, stu.basic.tel);
    						//break;
    					}
    				}
    				if (exist == 0) printf("查无此人!\n\n");
    				rewind(fp);//关键!!
    			}
    		}
    		else if (num == 2)//姓名
    		{
    			printf("\t\t\t\t\t\t<键入'#'并回车退出>\n");
    			int exist;
    			char item[10]="";
    			while (1)
    			{
    				exist = 0;
    				printf("输入姓名:");
    				scanf("%s", item);
    				while (getchar() != '\n')continue;
    				if (item[0] == '#')//#则退出
    				{
    					fcloseall();
    					break;
    				}
    				while (fgetc(fp) != EOF)//遍历
    				{
    					fseek(fp, -1L, 1);
    					fread(&stu, 240, 1, fp);
    					if (strcmp(stu.basic.name, item) == 0)//找到相同项就打印出来
    					{
    						exist = 1;
    						printf("%-15s%-10s%-5s%-10s%-15s\n", "学号", "姓名", "性别", "宿舍号码", "电话号码");
    						printf("%-15s%-10s%-5s%-10s%-15s\n\n", stu.basic.id, stu.basic.name, stu.basic.sex, stu.basic.dom, stu.basic.tel);
    						break;
    					}
    				}
    				if (exist == 0) printf("查无此人!\n\n");
    				rewind(fp);//关键!!
    			}
    		}
    		else
    		{
    			printf("二选一!\n");
    			system("pause");
    			Paint_Start();
    		}
    		fcloseall();
    		Paint_Start();
    	}
    	else
    	{
    		if (num == 2)//宿舍号码
    		{
    			char item[5] = "";
    			fp = fopen("stu.db", "rb");
    			if (fp == NULL)
    			{
    				printf("数据库打开失败!\n");
    				system("pause");
    				Paint_Start();
    				return;
    			}
    			int exist;
    			printf("\t\t\t\t\t\t<键入'#'并回车退出>\n");
    			while (1)
    			{
    				exist = 0;
    				printf("宿舍号码:");
    				scanf("%s",item);
    				while (getchar() != '\n')continue;
    				if (item[0] == '#')//#则退出
    				{
    					fcloseall();//奇怪的问题,fclose无法关闭文件流,只有fcloseall可以
    					break;
    				}
    				printf("%-15s%-10s%-5s%-10s%-15s\n", "学号", "姓名", "性别", "宿舍号码", "电话号码");
    				while (fgetc(fp)!=EOF)
    				{
    					fseek(fp,-1L,1);
    					fread(&stu,240,1,fp);
    					if (strcmp(stu.basic.dom, item) == 0)
    					{
    						exist = 1;
    						printf("%-15s%-10s%-5s%-10s%-15s\n", stu.basic.id, stu.basic.name, stu.basic.sex, stu.basic.dom, stu.basic.tel);
    					}
    				}
    				if (exist == 0) printf("找不到这个宿舍的人!\n\n");
    				else printf("\n");
    				rewind(fp);//这个很关键!!
    			}
    		}
    		else
    		{
    			printf("二选一噢~\n");//如果既没输1也没输2就打印它
    			system("pause");
    		}
    	}
    	fcloseall();
    	Paint_Start();
    }
    //成绩查询
    void find_score()
    {
    	student stu;
    	int num;
    	char item[30] = "";//用于储存姓名或者学号 跟数据库条目对比
    	FILE* fp;
    	fp = fopen("stu.db", "rb");
    	if (fp == NULL)
    	{
    		printf("数据库打开失败!\n");
    		system("pause");
    		Paint_Start();
    		return;
    	}
    		printf("选择通过学号(输入1),姓名(输入2)查找,按Enter键确认:\n");
    		scanf("%d", &num);
    		while (getchar() != '\n')continue;
    		if (num == 1)//学号
    		{
    			printf("\t\t\t\t\t\t<键入'#'并回车退出>\n");
    			int exist;
    			while (1)
    			{
    				exist = 0;
    				printf("输入学号:");
    				scanf("%s", item);
    				while (getchar() != '\n')continue;
    				if (item[0] == '#')//#则退出
    				{
    					fcloseall();
    					Paint_Start();
    					return;
    				}
    				printf("***********************************************************************************************************************\n");
    				while (fgetc(fp) != EOF)//遍历
    				{
    					fseek(fp, -1L, 1);
    					fread(&stu, 240, 1, fp);
    					if (strcmp(stu.basic.id, item) == 0)//找到相同项就打印出来
    					{
    						exist = 1;
    						int n = 0;
    						float finalcredit = 0;
    						printf("学号:%-15s姓名:%-s\n\n", stu.basic.id, stu.basic.name);
    						if (stu.sco.ch.has)
    						{
    							printf("课程编号:A    课程名称:语文    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.ch.overal, stu.sco.ch.real_credit); n++;
    							finalcredit = finalcredit + stu.sco.ch.real_credit;
    						}
    						if (stu.sco.ma.has)
    						{
    							printf("课程编号:B    课程名称:数学    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.ma.overal, stu.sco.ma.real_credit); n++;
    							finalcredit = finalcredit + stu.sco.ma.real_credit;
    						}
    						if (stu.sco.en.has)
    						{
    							printf("课程编号:C    课程名称:英语    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.en.overal, stu.sco.en.real_credit); n++;
    							finalcredit = finalcredit + stu.sco.en.real_credit;
    						}
    						if (stu.sco.pe.has)
    						{
    							printf("课程编号:D    课程名称:体育    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.pe.overal, stu.sco.pe.real_credit); n++;
    							finalcredit = finalcredit + stu.sco.pe.real_credit;
    						}
    						if (stu.sco.se.has)
    						{
    							printf("课程编号:E    课程名称:专业    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.se.overal, stu.sco.se.real_credit); n++;
    							finalcredit = finalcredit + stu.sco.se.real_credit;
    						}
    						if ((stu.sco.ch.has) || (stu.sco.ma.has) || (stu.sco.en.has) || (stu.sco.pe.has) || (stu.sco.se.has))
    							printf("\n\t\t\t\t  共修:%d科   实得总学分为:%.2f\n\n", n, finalcredit);
    						else printf("无成绩!\n\n");
    						break;
    					}
    				}
    				if (exist == 0) printf("查无此人!\n");
    				printf("***********************************************************************************************************************\n");
    				rewind(fp);//关键!!
    			}
    		}
    		else if (num == 2)//姓名
    		{
    			printf("\t\t\t\t\t\t<键入'#'并回车退出>\n");
    			int exist;
    			char item[10] = "";
    			while (1)
    			{
    				exist = 0;
    				printf("输入姓名:");
    				scanf("%s", item);
    				while (getchar() != '\n')continue;
    				if (item[0] == '#')//#则退出
    				{
    					fcloseall();
    					Paint_Start();
    					return;
    				}
    				printf("***********************************************************************************************************************\n");
    				while (fgetc(fp) != EOF)//遍历
    				{
    					fseek(fp, -1L, 1);
    					fread(&stu, 240, 1, fp);
    					if (strcmp(stu.basic.name, item) == 0)//找到相同项就打印出来
    					{
    						exist = 1;
    						int n=0;
    						float finalcredit=0;
    						printf("学号:%-15s姓名:%-s\n\n", stu.basic.id, stu.basic.name);
    						if (stu.sco.ch.has)
    						{
    							printf("课程编号:A    课程名称:语文    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.ch.overal, stu.sco.ch.real_credit); n++;
    							finalcredit = finalcredit + stu.sco.ch.real_credit;
    						}
    						if (stu.sco.ma.has)
    						{
    							printf("课程编号:B    课程名称:数学    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.ma.overal, stu.sco.ma.real_credit); n++;
    							finalcredit = finalcredit + stu.sco.ma.real_credit;
    						}
    						if (stu.sco.en.has)
    						{
    							printf("课程编号:C    课程名称:英语    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.en.overal, stu.sco.en.real_credit); n++;
    							finalcredit = finalcredit + stu.sco.en.real_credit;
    						}
    						if (stu.sco.pe.has)
    						{
    							printf("课程编号:D    课程名称:体育    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.pe.overal, stu.sco.pe.real_credit); n++;
    							finalcredit = finalcredit + stu.sco.pe.real_credit;
    						}
    						if (stu.sco.se.has)
    						{
    							printf("课程编号:E    课程名称:专业    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.se.overal, stu.sco.se.real_credit); n++;
    							finalcredit = finalcredit + stu.sco.se.real_credit;
    						}
    						if ((stu.sco.ch.has) || (stu.sco.ma.has) || (stu.sco.en.has) || (stu.sco.pe.has) || (stu.sco.se.has))
    						printf("\n\t\t\t\t  共修:%d科   实得总学分为:%.2f\n\n", n, finalcredit);
    						else printf("无成绩!\n\n");
    						break;
    					}
    				}
    				if (exist == 0) printf("查无此人!\n");
    				printf("***********************************************************************************************************************\n");
    				rewind(fp);//关键!!
    			}
    		}
    		else
    		{
    			printf("二选一!\n");
    			system("pause");
    			fcloseall();
    			Paint_Start();
    		}
    		fcloseall();
    }
    //数据删除
    void del()//删除成绩 
    {
    	FILE* fp, * fpp;
    	student stu;
    	char id[30] = "";
    	int i;
    	printf("**********************************************输入'#'并回车可退出此功能************************************************\n");
    	while (1)
    	{
    		memset(id, 0, 30);
    		fpp = fopen("stutemp.db", "wb");//临时新建的文件,用于储存删除一个人后所以人的数据,然后把他变成stu.db,把原来的stu.db删除,起到删除一个人数据而不留空的目的
    		fcloseall();
    		if ((fp = fopen("stu.db", "rb+")) == NULL)
    		{
    			printf("文件打开失败!\n");
    			system("pause");
    			Paint_Start();
    			return;
    		}
    		if ((fpp = fopen("stutemp.db", "rb+")) == NULL)
    		{
    			printf("临时文件创建失败!\n");
    			system("pause");
    			return;
    		}
    		printf("输入目标学号:");//姓名会重,学号不会重		//先查找再删除
    		scanf("%s", id);
    		while (getchar() != '\n')continue;
    		if (id[0] == '#')
    		{
    			break;
    		}
    		int done = 0;
    		for (i = 1; fgetc(fp) != EOF; i++)//与id相同的第i个数据
    		{
    			fseek(fp, -1L, 1);
    			fread(&stu, 240, 1, fp);
    			if (strcmp(id, stu.basic.id) == 0)
    			{
    				done = 1;
    				break;
    			}
    		}
    		rewind(fp);
    		rewind(fpp);
    		if (done == 1)//存在此人则输出信息
    		{
    			printf("\n以下为该学生成绩和基本信息:\n");
    			printf("%-15s%-10s%-5s%-10s%-15s\n", "学号", "姓名", "性别", "宿舍号码", "电话号码");
    			printf("%-15s%-10s%-5s%-10s%-15s\n", stu.basic.id, stu.basic.name, stu.basic.sex, stu.basic.dom, stu.basic.tel);
    			int n = 0;
    			float finalcredit = 0;
    			printf("学生成绩:\n");
    			if (stu.sco.ch.has)
    			{
    				printf("课程编号:A    课程名称:语文    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.ch.overal, stu.sco.ch.real_credit); n++;
    				finalcredit = finalcredit + stu.sco.ch.real_credit;
    			}
    			if (stu.sco.ma.has)
    			{
    				printf("课程编号:B    课程名称:数学    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.ma.overal, stu.sco.ma.real_credit); n++;
    				finalcredit = finalcredit + stu.sco.ma.real_credit;
    			}
    			if (stu.sco.en.has)
    			{
    				printf("课程编号:C    课程名称:英语    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.en.overal, stu.sco.en.real_credit); n++;
    				finalcredit = finalcredit + stu.sco.en.real_credit;
    			}
    			if (stu.sco.pe.has)
    			{
    				printf("课程编号:D    课程名称:体育    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.pe.overal, stu.sco.pe.real_credit); n++;
    				finalcredit = finalcredit + stu.sco.pe.real_credit;
    			}
    			if (stu.sco.se.has)
    			{
    				printf("课程编号:E    课程名称:专业    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.se.overal, stu.sco.se.real_credit); n++;
    				finalcredit = finalcredit + stu.sco.se.real_credit;
    			}
    			printf("\n\t\t\t\t   共修:%d科   实得总学分为:%.2f\n\n", n, finalcredit);
    			printf("\n请确认是否要删除该学生全部数据?(输入:'y'删除,'n'取消)\n");
    			printf(">>");
    			scanf("%s", id);
    			while (getchar() != '\n')continue;
    			if (id[0] == 'y')
    			{
    				for (int j = 1; fgetc(fp) != EOF; j++)//把stu里的每一条数据,除了i标记的那条(也就是要删除的那条),都写入临时文件
    				{
    					fseek(fp, -1L, 1);
    					if (j == i)
    					{
    						fseek(fp, 240L, 1);
    						if (fgetc(fp) == EOF)break;
    						else fseek(fp, -1L, 1);
    					}
    					fread(&stu, 240, 1, fp);
    					if (fwrite(&stu, 240, 1, fpp) != 1)
    					{
    						printf("写入临时文件失败!\n");
    						done = 0;
    					}
    				}
    				fcloseall();
    				system("del stu.db");//命令提示符多方便
    				system("rename stutemp.db stu.db");//删了stu.db拿stutemp.db充当stu.db
    				if (done == 0)printf("删除失败!\n\n");
    				else printf("数据已删除!\n");
    				printf("***********************************************************************************************************************\n");
    			}
    			else
    			{
    				if (id[0] == 'n')
    					printf("已取消!\n\n");
    				else
    				{
    					printf("未知指令!\n\n");
    				}
    				printf("***********************************************************************************************************************\n");
    			}
    		}
    		else
    		{
    			printf("查无此人!\n\n");
    			printf("***********************************************************************************************************************\n");
    		}
    		fcloseall();
    	}
    	fcloseall();
    	Paint_Start();
    } 
    //成绩分段
    void div()//成绩分段
    {
    	system("cls");
    	printf("******************************************************成绩分段**********************************************************\n");
    	printf("根据平均综合成绩可将学生分为A,B,C三个档次:\n");
    	printf("\t\t\t\t\t\t      ***A***\n\n");
    	FILE* fp;
    	int i, j;
    	student stu;
    	if ((fp = fopen("stu.db", "rb")) == NULL)
    	{
    		printf("文件打开失败!\n");
    		return;
    	}
    	printf("\t\t\t学号           姓名      语文   数学   英语   体育   专业   平均综合\n");
    	for (;fgetc(fp)!=EOF;)//一条条判断是不是在某范围内,在,则打印
    	{
    		fseek(fp,-1L,1);
    		fread(&stu,240,1,fp);
    		stu.sco.overal_aver = (stu.sco.ch.overal + stu.sco.ma.overal + stu.sco.en.overal + stu.sco.pe.overal + stu.sco.se.overal) / 5.0;//平均综合成绩
    		if (stu.sco.overal_aver >= 80)
    			printf("\t\t\t%-15s%-10s%-7.1f%-7.1f%-7.1f%-7.1f%-7.1f%-10.2f\n", stu.basic.id, stu.basic.name, stu.sco.ch.overal, stu.sco.ma.overal, stu.sco.en.overal, stu.sco.pe.overal, stu.sco.se.overal, stu.sco.overal_aver);
    	}
    	rewind(fp);
    	printf("\n\n\t\t\t\t\t\t       **B**\n\n");
    	printf("\t\t\t学号           姓名      语文   数学   英语   体育   专业   平均综合\n");
    	for (; fgetc(fp) != EOF;)
    	{
    		fseek(fp, -1L, 1);
    		fread(&stu, 240, 1, fp);
    		stu.sco.overal_aver = (stu.sco.ch.overal + stu.sco.ma.overal + stu.sco.en.overal + stu.sco.pe.overal + stu.sco.se.overal) / 5.0;//平均综合成绩
    		if (stu.sco.overal_aver < 80&&stu.sco.overal_aver>=60)
    			printf("\t\t\t%-15s%-10s%-7.1f%-7.1f%-7.1f%-7.1f%-7.1f%-10.2f\n", stu.basic.id, stu.basic.name, stu.sco.ch.overal, stu.sco.ma.overal, stu.sco.en.overal, stu.sco.pe.overal, stu.sco.se.overal, stu.sco.overal_aver);
    	}
    	rewind(fp);
    	printf("\n\n\t\t\t\t\t\t        *C*\n\n");
    	printf("\t\t\t学号           姓名      语文   数学   英语   体育   专业   平均综合\n");
    	for (; fgetc(fp) != EOF;)
    	{
    		fseek(fp, -1L, 1);
    		fread(&stu, 240, 1, fp);
    		stu.sco.overal_aver = (stu.sco.ch.overal + stu.sco.ma.overal + stu.sco.en.overal + stu.sco.pe.overal + stu.sco.se.overal) / 5.0;//平均综合成绩
    		if (stu.sco.overal_aver < 60)
    			printf("\t\t\t%-15s%-10s%-7.1f%-7.1f%-7.1f%-7.1f%-7.1f%-10.2f\n", stu.basic.id, stu.basic.name, stu.sco.ch.overal, stu.sco.ma.overal, stu.sco.en.overal, stu.sco.pe.overal, stu.sco.se.overal, stu.sco.overal_aver);
    	}
    	fcloseall();
    	printf("\n\t\t\t\t\t\t\t\t\t      ");
    	system("pause");
    	Paint_Start();
    	return;
    }
    //文件输出
    void outfile()//输出文件内容 
    {
    	char dir[50]="";
    	float total;
    	FILE* fp;
    	student stu;
    	system("cls");
    	printf("*****************************************************文件输出***********************************************************\n");
    	printf("输入文件的绝对路径(例如C:\\xxxxx.db):\n");
    	scanf("%s", dir);
    	while (getchar() != '\n')continue;
    	if ((fp = fopen(dir, "rb")) == NULL)
    	{
    		printf("文件打开失败!");
    		system("pause");
    		Paint_Start();
    		return;
    	}
    	printf("****************************************************************************\n");
    	printf("* 学号           姓名      性别 宿舍号 电话号    平均综合成绩 平均综合学分 *\n");
    	for (; fgetc(fp) != EOF;)
    	{
    		fseek(fp, -1L, SEEK_CUR);
    		fread(&stu, 240, 1, fp);
    		stu.sco.overal_aver = (stu.sco.ch.overal + stu.sco.ma.overal + stu.sco.en.overal + stu.sco.pe.overal + stu.sco.se.overal) / 5.0;//平均综合成绩
    		stu.sco.credit_aver = (stu.sco.ch.real_credit + stu.sco.ma.real_credit + stu.sco.en.real_credit + stu.sco.pe.real_credit + stu.sco.se.real_credit) / 5.0;//平均综合学分
    		printf("* %-15s%-10s%-5s%-7s%-10s%-13f%-13f*\n", stu.basic.id,stu.basic.name,stu.basic.sex,stu.basic.dom,stu.basic.tel,stu.sco.overal_aver,stu.sco.credit_aver);
    	}
    	printf("****************************************************************************\n");
    	fcloseall();
    	printf("\n\t\t\t\t\t\t              ");
    	system("pause");
    	Paint_Start();
    }
    //假的文件储存
    void savefile()//文件储存
    {
    	printf("文件stu.db已储存到源程序根目录!");
    	system("pause");
    	Paint_Start();
    }
    //成绩追加
    void add()//追加,在文件末尾
    {
    	system("cls");
    	printf("*****************************************************成绩追加***********************************************************\n");
    	printf("依次键入学号、姓名、性别、宿舍号码、电话号码,用一个空格隔开各数据,回车键确认。样例:541913460230 喵辰汐 男 113 10086\n");
    	FILE* fp;
    	student stu;
    	bool err = false;
    	char id[30], name[10], sex[5] = "", dom[5], tel[20];
    	char  subid[5], subname[10], daily[5], credit[5], experi[5], paper[5];
    	fp = fopen("stu.db", "rb+");
    	if (fp == NULL)
    	{
    		printf("文件打开失败!\n");
    		Paint_Start();
    		return;
    	}
    		memset(id, 0, 30);
    		memset(name, 0, 10);
    		memset(sex, 0, 5);
    		memset(dom, 0, 5);
    		memset(tel, 0, 20);
    		printf("输入:");
    		scanf("%s %s %s %s %s",id, name, sex, dom, tel);
    		while (getchar() != '\n')continue;
    
    		bool isname = true;
    		for (int i = 0; i <= 7; i++)
    		{
    			if (name[i] >= 32 && name[i] <= 127) isname = false;//仅判断是否是ASCII中的字符
    		}
    		if (name[8] == '\0' && isname == true)//一个中文字符占两个字节
    		{
    			strcpy(stu.basic.name, name);
    		}
    		else
    		{
    			printf("请检查姓名输入是否正确,并重新输入!\n");
    			err = true;
    		}
    
    		if (ifnum(id) && id[11] != '\0' && id[12] == '\0') strcpy(stu.basic.id, id);
    		else
    		{
    			printf("请检查学号输入是否正确,并重新输入!\n");
    			err = true;
    		}
    		if (strcmp(sex, "男") == 0 || strcmp(sex, "女") == 0) strcpy(stu.basic.sex, sex);
    		else
    		{
    			printf("请检查性别输入是否正确,并重新输入!\n");
    			err = true;
    		}
    		if (ifnum(dom)) strcpy(stu.basic.dom, dom);
    		else
    		{
    			printf("请检查宿舍号码输入是否正确,并重新输入!\n");
    			err = true;
    		}
    		if (ifnum(tel)) strcpy(stu.basic.tel, tel);
    		else
    		{
    			printf("请检查电话号码输入是否正确,并重新输入!\n");
    			err = true;
    		}
    		if (err == false)
    		{
    			int exist = 0;
    			student _stu = stu;
    			while (fgetc(fp) != EOF)//遍历
    			{
    				fseek(fp, -1L, 1);
    				fread(&_stu, 240, 1, fp);
    				if (strcmp(_stu.basic.id, id) == 0)//找到相同项
    				{
    					exist = 1;
    					printf("已有此人!\n");
    					system("pause"); 
    					fcloseall();
    					Paint_Start();
    					return;
    				}
    			}
    			if (exist == 0)//文件指针已在末尾
    			{
    				printf("***********************************************************************************************************************\n");
    				printf("依次输入课程编号(A-E)、课程名称(编号为准)、学分、平时成绩、实验成绩、卷面成绩,用一个空格隔开各数据,回车键确认(输入'#'键并回车结束输入)。\n例如:A 语文 3 66 78 82\n");
    				printf("输入:\n");
    				while (err == false)
    				{
    					scanf("%s", subid);
    					if (subid[0] == '#')
    					{//此处绝对不能关闭文件流,下面将要写入文件
    						break;
    					}
    					scanf(" %s %s %s %s %s", subname, credit, daily, experi, paper);
    					while (getchar() != '\n')continue;
    					if (subid[0] >= 'A' && subid[0] <= 'E' && subid[1] == '\0');
    					else
    					{
    						printf("请检查课程编号输入是否正确,并重新输入!\n");
    						err = true;
    					}
    					if (ifnum(credit));
    					else
    					{
    						printf("请检查学分输入是否正确,并重新输入!\n");
    						err = true;
    					}
    					if (ifnum(daily) && ((daily[0] == '1' && daily[1] == '0' && daily[2] == '0') || (daily[2] == '\0' && daily[3] != '\0') || daily[2] == '\0'));
    					else
    					{
    						printf("请检查平时成绩输入是否正确,并重新输入!\n");
    						err = true;
    					}
    					if (ifnum(experi) && ((experi[0] == '1' && experi[1] == '0' && experi[2] == '0') || (experi[2] == '\0' && experi[3] != '\0') || experi[2] == '\0'));
    					else
    					{
    						printf("请检查实验成绩输入是否正确,并重新输入!\n");
    						err = true;
    					}
    					if (ifnum(paper) && ((paper[0] == '1' && paper[1] == '0' && paper[2] == '0') || (paper[2] == '\0' && paper[3] != '\0') || paper[2] == '\0'));
    					else
    					{
    						printf("请检查卷面成绩输入是否正确,并重新输入!\n");
    						err = true;
    					}
    					switch (subid[0])//各项成绩信息计算并存入stu结构体
    					{
    					case 'A':
    					{
    						stu.sco.ch.has = true;
    						strcpy(stu.sco.ch.credit, credit);
    						strcpy(stu.sco.ch.daily, daily);
    						strcpy(stu.sco.ch.experi, experi);
    						strcpy(stu.sco.ch.paper, paper);
    						float credittemp;
    						if (credit[2] == '0') credittemp = 100;
    						else if (credit[1] != '\0')
    							credittemp = ((int)credit[0] - 48) * 10 + (int)credit[1] - 48;
    						else credittemp = (int)credit[0] - 48;
    						float dailytemp, papertemp, experitemp;
    						if (daily[2] == '0') dailytemp = 100;
    						else if (daily[1] != '\0')
    							dailytemp = ((int)daily[0] - 48) * 10 + (int)daily[1] - 48;
    						else dailytemp = (int)daily[0] - 48;
    						if (paper[2] == '0') papertemp = 100;
    						else if (paper[1] != '\0')
    							papertemp = ((int)paper[0] - 48) * 10 + (int)paper[1] - 48;
    						else papertemp = (int)paper[0] - 48;
    						if (strcmp(experi, "-1") == 0)
    						{
    							stu.sco.ch.overal = dailytemp * 0.3 + papertemp * 0.7;
    						}
    						else
    						{
    							if (experi[2] == '0') experitemp = 100;
    							else if (experi[1] != '\0')
    								experitemp = ((int)experi[0] - 48) * 10 + (int)experi[1] - 48;
    							else experitemp = (int)experi[0] - 48;
    							stu.sco.ch.overal = dailytemp * 0.15 + experitemp * 0.15 + papertemp * 0.7;
    						}
    						if (stu.sco.ch.overal >= 90 && stu.sco.ch.overal <= 100)
    							stu.sco.ch.real_credit = credittemp;
    						else if (stu.sco.ch.overal < 90 && stu.sco.ch.overal >= 80) stu.sco.ch.real_credit = credittemp * 0.8;
    						else if (stu.sco.ch.overal < 80 && stu.sco.ch.overal >= 70) stu.sco.ch.real_credit = credittemp * 0.75;
    						else if (stu.sco.ch.overal < 70 && stu.sco.ch.overal >= 60) stu.sco.ch.real_credit = credittemp * 0.6;
    						else stu.sco.ch.real_credit = 0;
    					}; break;
    					case 'B':
    					{
    						stu.sco.ma.has = true;
    						strcpy(stu.sco.ma.credit, credit);
    						strcpy(stu.sco.ma.daily, daily);
    						strcpy(stu.sco.ma.experi, experi);
    						strcpy(stu.sco.ma.paper, paper);
    						float credittemp;
    						if (credit[2] == '0') credittemp = 100;
    						else if (credit[1] != '\0')
    							credittemp = ((int)credit[0] - 48) * 10 + (int)credit[1] - 48;
    						else credittemp = (int)credit[0] - 48;
    						float dailytemp, papertemp, experitemp;
    						if (daily[2] == '0') dailytemp = 100;
    						else if (daily[1] != '\0')
    							dailytemp = ((int)daily[0] - 48) * 10 + (int)daily[1] - 48;
    						else dailytemp = (int)daily[0] - 48;
    						if (paper[2] == '0') papertemp = 100;
    						else if (paper[1] != '\0')
    							papertemp = ((int)paper[0] - 48) * 10 + (int)paper[1] - 48;
    						else papertemp = (int)paper[0] - 48;
    						if (strcmp(experi, "-1") == 0)
    						{
    							stu.sco.ma.overal = dailytemp * 0.3 + papertemp * 0.7;
    						}
    						else
    						{
    							if (experi[2] == '0') experitemp = 100;
    							else if (experi[1] != '\0')
    								experitemp = ((int)experi[0] - 48) * 10 + (int)experi[1] - 48;
    							else experitemp = (int)experi[0] - 48;
    							stu.sco.ma.overal = dailytemp * 0.15 + experitemp * 0.15 + papertemp * 0.7;
    						}
    						if (stu.sco.ma.overal >= 90 && stu.sco.ma.overal <= 100)
    							stu.sco.ma.real_credit = credittemp;
    						else if (stu.sco.ma.overal < 90 && stu.sco.ma.overal >= 80) stu.sco.ma.real_credit = credittemp * 0.8;
    						else if (stu.sco.ma.overal < 80 && stu.sco.ma.overal >= 70) stu.sco.ma.real_credit = credittemp * 0.75;
    						else if (stu.sco.ma.overal < 70 && stu.sco.ma.overal >= 60) stu.sco.ma.real_credit = credittemp * 0.6;
    						else stu.sco.ma.real_credit = 0;
    					}; break;
    					case 'C':
    					{
    						stu.sco.en.has = true;
    						strcpy(stu.sco.en.credit, credit);
    						strcpy(stu.sco.en.daily, daily);
    						strcpy(stu.sco.en.experi, experi);
    						strcpy(stu.sco.en.paper, paper);
    						float credittemp;
    						if (credit[2] == '0') credittemp = 100;
    						else if (credit[1] != '\0')
    							credittemp = ((int)credit[0] - 48) * 10 + (int)credit[1] - 48;
    						else credittemp = (int)credit[0] - 48;
    						float dailytemp, papertemp, experitemp;
    						if (daily[2] == '0') dailytemp = 100;
    						else if (daily[1] != '\0')
    							dailytemp = ((int)daily[0] - 48) * 10 + (int)daily[1] - 48;
    						else dailytemp = (int)daily[0] - 48;
    						if (paper[2] == '0') papertemp = 100;
    						else if (paper[1] != '\0')
    							papertemp = ((int)paper[0] - 48) * 10 + (int)paper[1] - 48;
    						else papertemp = (int)paper[0] - 48;
    						if (strcmp(experi, "-1") == 0)
    						{
    							stu.sco.en.overal = dailytemp * 0.3 + papertemp * 0.7;
    						}
    						else
    						{
    							if (experi[2] == '0') experitemp = 100;
    							else if (experi[1] != '\0')
    								experitemp = ((int)experi[0] - 48) * 10 + (int)experi[1] - 48;
    							else experitemp = (int)experi[0] - 48;
    							stu.sco.en.overal = dailytemp * 0.15 + experitemp * 0.15 + papertemp * 0.7;
    						}
    						if (stu.sco.en.overal >= 90 && stu.sco.en.overal <= 100)
    							stu.sco.en.real_credit = credittemp;
    						else if (stu.sco.en.overal < 90 && stu.sco.en.overal >= 80) stu.sco.en.real_credit = credittemp * 0.8;
    						else if (stu.sco.en.overal < 80 && stu.sco.en.overal >= 70) stu.sco.en.real_credit = credittemp * 0.75;
    						else if (stu.sco.en.overal < 70 && stu.sco.en.overal >= 60) stu.sco.en.real_credit = credittemp * 0.6;
    						else stu.sco.en.real_credit = 0;
    					}; break;
    					case 'D':
    					{
    						stu.sco.pe.has = true;
    						strcpy(stu.sco.pe.credit, credit);
    						strcpy(stu.sco.pe.daily, daily);
    						strcpy(stu.sco.pe.experi, experi);
    						strcpy(stu.sco.pe.paper, paper);
    						float credittemp;
    						if (credit[2] == '0') credittemp = 100;
    						else if (credit[1] != '\0')
    							credittemp = ((int)credit[0] - 48) * 10 + (int)credit[1] - 48;
    						else credittemp = (int)credit[0] - 48;
    						float dailytemp, papertemp, experitemp;
    						if (daily[2] == '0') dailytemp = 100;
    						else if (daily[1] != '\0')
    							dailytemp = ((int)daily[0] - 48) * 10 + (int)daily[1] - 48;
    						else dailytemp = (int)daily[0] - 48;
    						if (paper[2] == '0') papertemp = 100;
    						else if (paper[1] != '\0')
    							papertemp = ((int)paper[0] - 48) * 10 + (int)paper[1] - 48;
    						else papertemp = (int)paper[0] - 48;
    						if (strcmp(experi, "-1") == 0)
    						{
    							stu.sco.pe.overal = dailytemp * 0.3 + papertemp * 0.7;
    						}
    						else
    						{
    							if (experi[2] == '0') experitemp = 100;
    							else if (experi[1] != '\0')
    								experitemp = ((int)experi[0] - 48) * 10 + (int)experi[1] - 48;
    							else experitemp = (int)experi[0] - 48;
    							stu.sco.pe.overal = dailytemp * 0.15 + experitemp * 0.15 + papertemp * 0.7;
    						}
    						if (stu.sco.pe.overal >= 90 && stu.sco.pe.overal <= 100)
    							stu.sco.pe.real_credit = credittemp;
    						else if (stu.sco.pe.overal < 90 && stu.sco.pe.overal >= 80) stu.sco.pe.real_credit = credittemp * 0.8;
    						else if (stu.sco.pe.overal < 80 && stu.sco.pe.overal >= 70) stu.sco.pe.real_credit = credittemp * 0.75;
    						else if (stu.sco.pe.overal < 70 && stu.sco.pe.overal >= 60) stu.sco.pe.real_credit = credittemp * 0.6;
    						else stu.sco.pe.real_credit = 0;
    					}; break;
    					case 'E':
    					{
    						stu.sco.se.has = true;
    						strcpy(stu.sco.se.credit, credit);
    						strcpy(stu.sco.se.daily, daily);
    						strcpy(stu.sco.se.experi, experi);
    						strcpy(stu.sco.se.paper, paper);
    						float credittemp;
    						if (credit[2] == '0') credittemp = 100;
    						else if (credit[1] != '\0')
    							credittemp = ((int)credit[0] - 48) * 10 + (int)credit[1] - 48;
    						else credittemp = (int)credit[0] - 48;
    						float dailytemp, papertemp, experitemp;
    						if (daily[2] == '0') dailytemp = 100;
    						else if (daily[1] != '\0')
    							dailytemp = ((int)daily[0] - 48) * 10 + (int)daily[1] - 48;
    						else dailytemp = (int)daily[0] - 48;
    						if (paper[2] == '0') papertemp = 100;
    						else if (paper[1] != '\0')
    							papertemp = ((int)paper[0] - 48) * 10 + (int)paper[1] - 48;
    						else papertemp = (int)paper[0] - 48;
    						if (strcmp(experi, "-1") == 0)
    						{
    							stu.sco.se.overal = dailytemp * 0.3 + papertemp * 0.7;
    						}
    						else
    						{
    							if (experi[2] == '0') experitemp = 100;
    							else if (experi[1] != '\0')
    								experitemp = ((int)experi[0] - 48) * 10 + (int)experi[1] - 48;
    							else experitemp = (int)experi[0] - 48;
    							stu.sco.se.overal = dailytemp * 0.15 + experitemp * 0.15 + papertemp * 0.7;
    						}
    						if (stu.sco.se.overal >= 90 && stu.sco.se.overal <= 100)
    							stu.sco.se.real_credit = credittemp;
    						else if (stu.sco.se.overal < 90 && stu.sco.se.overal >= 80) stu.sco.se.real_credit = credittemp * 0.8;
    						else if (stu.sco.se.overal < 80 && stu.sco.se.overal >= 70) stu.sco.se.real_credit = credittemp * 0.75;
    						else if (stu.sco.se.overal < 70 && stu.sco.se.overal >= 60) stu.sco.se.real_credit = credittemp * 0.6;
    						else stu.sco.se.real_credit = 0;
    					}
    					//已经全部存入stu
    					}
    				}
    				fwrite(&stu, 240, 1, fp);
    				fcloseall();
    				printf("***********************************************************************************************************************\n");
    				printf("以下是新增学生基本信息:\n");
    				printf("%-15s%-10s%-5s%-10s%-15s\n", "学号", "姓名", "性别", "宿舍号码", "电话号码");
    				printf("%-15s%-10s%-5s%-10s%-15s\n", stu.basic.id, stu.basic.name, stu.basic.sex, stu.basic.dom, stu.basic.tel);
    				printf("\n以下是新增学生成绩:\n");
    				int n = 0;
    				float finalcredit = 0;
    				printf("\n学号:%-15s姓名:%-s\n\n", stu.basic.id, stu.basic.name);
    				if (stu.sco.ch.has)
    				{
    					printf("课程编号:A    课程名称:语文    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.ch.overal, stu.sco.ch.real_credit); n++;
    					finalcredit = finalcredit + stu.sco.ch.real_credit;
    				}
    				if (stu.sco.ma.has)
    				{
    					printf("课程编号:B    课程名称:数学    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.ma.overal, stu.sco.ma.real_credit); n++;
    					finalcredit = finalcredit + stu.sco.ma.real_credit;
    				}
    				if (stu.sco.en.has)
    				{
    					printf("课程编号:C    课程名称:英语    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.en.overal, stu.sco.en.real_credit); n++;
    					finalcredit = finalcredit + stu.sco.en.real_credit;
    				}
    				if (stu.sco.pe.has)
    				{
    					printf("课程编号:D    课程名称:体育    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.pe.overal, stu.sco.pe.real_credit); n++;
    					finalcredit = finalcredit + stu.sco.pe.real_credit;
    				}
    				if (stu.sco.se.has)
    				{
    					printf("课程编号:E    课程名称:专业    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.se.overal, stu.sco.se.real_credit); n++;
    					finalcredit = finalcredit + stu.sco.se.real_credit;
    				}
    				printf("\n\t\t\t\t   共修:%d科   实得总学分为:%.2f\n\n", n, finalcredit);
    				system("pause");
    				Paint_Start();
    			}
    		}
    		if (fp != NULL)fcloseall();
    		system("pause");
    		Paint_Start();
    }
    //成绩修改
    void edit()//先查找,再编辑
    {
    	student stu;
    	int exist;
    	bool err;
    	char id[30], subid[5], subname[10], daily[5], credit[5], experi[5], paper[5];
    	char item[30] = "";
    	FILE* fp;
    	printf("\t\t\t\t\t\t<键入'#'并回车退出>\n");
    	fp = fopen("stu.db", "rb+");
    	if (fp == NULL)
    		{
    			printf("数据库打开失败!\n");
    			system("pause");
    			Paint_Start();
    			return;
    		}
    	while (1)
    	{
    		exist = 0;
    		printf("学号:");
    		scanf("%s", item);
    		while (getchar() != '\n')continue;
    		if (item[0] == '#')break;
    		printf("***********************************************************************************************************************\n");
    		while (fgetc(fp) != EOF)//先查人
    			{
    				fseek(fp, -1L, 1);
    				fread(&stu, 240, 1, fp);//先读取,再一个个比较,直到读到底都没有一样的就直接结束了,或者读到一样的就输出到屏幕,然后开始读取学生信息和成绩,输入成绩,仅(替换)录入成绩
    				if (strcmp(stu.basic.id, item) == 0)
    				{
    					exist = 1;
    					int n = 0;
    					float finalcredit = 0;
    					printf("学号:%-15s姓名:%-s\n\n", stu.basic.id, stu.basic.name);
    					if (stu.sco.ch.has)
    					{
    						printf("课程编号:A    课程名称:语文    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.ch.overal, stu.sco.ch.real_credit); n++;
    						finalcredit = finalcredit + stu.sco.ch.real_credit;
    					}
    					if (stu.sco.ma.has)
    					{
    						printf("课程编号:B    课程名称:数学    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.ma.overal, stu.sco.ma.real_credit); n++;
    						finalcredit = finalcredit + stu.sco.ma.real_credit;
    					}
    					if (stu.sco.en.has)
    					{
    						printf("课程编号:C    课程名称:英语    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.en.overal, stu.sco.en.real_credit); n++;
    						finalcredit = finalcredit + stu.sco.en.real_credit;
    					}
    					if (stu.sco.pe.has)
    					{
    						printf("课程编号:D    课程名称:体育    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.pe.overal, stu.sco.pe.real_credit); n++;
    						finalcredit = finalcredit + stu.sco.pe.real_credit;
    					}
    					if (stu.sco.se.has)
    					{
    						printf("课程编号:E    课程名称:专业    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.se.overal, stu.sco.se.real_credit); n++;
    						finalcredit = finalcredit + stu.sco.se.real_credit;
    					}
    					printf("\n\t\t\t\t   共修:%d科   实得总学分为:%.2f\n\n", n, finalcredit);
    					printf("***********************************************************************************************************************\n");
    					break;
    				}
    			}
    		if (exist == 0)
    			{
    				printf("查无此人!\n");
    			}
    		else//人存在,成绩也存在
    		{
    				err = false;//是否有错误
    				memset(id, 0, 30);//清空各数组所占内存的内容,都变成空,方便后续判断
    				memset(subid, 0, 5);
    				memset(subname, 0, 10);
    				memset(credit, 0, 5);
    				memset(daily, 0, 5);
    				memset(experi, 0, 5);
    				memset(paper, 0, 5);//这样以后,所有元素都变成\0了
    				printf("依次输入课程编号(A-E)、课程名称(以编号为准)、学分、平时成绩、实验成绩、卷面成绩,用一个空格隔开各数据,每一条输入完成后按回车键进行下一条输入。例如:A 语文 3 66 78 82\n输入:");
    				scanf("%s %s %s %s %s %s", subid, subname, credit, daily, experi, paper);
    				while (getchar() != '\n')continue;
    				if (subid[0] >= 'A' && subid[0] <= 'E' && subid[1] == '\0');
    				else
    				{
    					printf("请检查课程编号输入是否正确,并重新输入!\n");
    					err = true;
    				}
    				if (ifnum(credit));
    				else
    				{
    					printf("请检查学分输入是否正确,并重新输入!\n");
    					err = true;
    				}
    				if (ifnum(daily) && ((daily[0] == '1' && daily[1] == '0' && daily[2] == '0') || (daily[2] == '\0' && daily[3] != '\0') || daily[2] == '\0'));
    				else
    				{
    					printf("请检查平时成绩输入是否正确,并重新输入!\n");
    					err = true;
    				}
    				if (ifnum(experi) && ((experi[0] == '1' && experi[1] == '0' && experi[2] == '0') || (experi[2] == '\0' && experi[3] != '\0') || experi[2] == '\0'));
    				else
    				{
    					printf("请检查实验成绩输入是否正确,并重新输入!\n");
    					err = true;
    				}
    				if (ifnum(paper) && ((paper[0] == '1' && paper[1] == '0' && paper[2] == '0') || (paper[2] == '\0' && paper[3] != '\0') || paper[2] == '\0'));
    				else
    				{
    					printf("请检查卷面成绩输入是否正确,并重新输入!\n");
    					err = true;
    				}
    				if (err == false)
    				{
    					strcpy(stu.basic.id,item);
    					switch (subid[0])
    					{
    					case 'A':
    					{
    						stu.sco.ch.has = true;
    						strcpy(stu.sco.ch.credit, credit);
    						strcpy(stu.sco.ch.daily, daily);
    						strcpy(stu.sco.ch.experi, experi);
    						strcpy(stu.sco.ch.paper, paper);
    						float credittemp;
    						if (credit[2] == '0') credittemp = 100;
    						else if (credit[1] != '\0')
    							credittemp = ((int)credit[0] - 48) * 10 + (int)credit[1] - 48;
    						else credittemp = (int)credit[0] - 48;
    						float dailytemp, papertemp, experitemp;
    						if (daily[2] == '0') dailytemp = 100;
    						else if (daily[1] != '\0')
    							dailytemp = ((int)daily[0] - 48) * 10 + (int)daily[1] - 48;
    						else dailytemp = (int)daily[0] - 48;
    						if (paper[2] == '0') papertemp = 100;
    						else if (paper[1] != '\0')
    							papertemp = ((int)paper[0] - 48) * 10 + (int)paper[1] - 48;
    						else papertemp = (int)paper[0] - 48;
    						if (strcmp(experi, "-1") == 0)
    						{
    							stu.sco.ch.overal = dailytemp * 0.3 + papertemp * 0.7;
    						}
    						else
    						{
    							if (experi[2] == '0') experitemp = 100;
    							else if (experi[1] != '\0')
    								experitemp = ((int)experi[0] - 48) * 10 + (int)experi[1] - 48;
    							else experitemp = (int)experi[0] - 48;
    							stu.sco.ch.overal = dailytemp * 0.15 + experitemp * 0.15 + papertemp * 0.7;
    						}
    						if (stu.sco.ch.overal >= 90 && stu.sco.ch.overal <= 100)
    							stu.sco.ch.real_credit = credittemp;
    						else if (stu.sco.ch.overal < 90 && stu.sco.ch.overal >= 80) stu.sco.ch.real_credit = credittemp * 0.8;
    						else if (stu.sco.ch.overal < 80 && stu.sco.ch.overal >= 70) stu.sco.ch.real_credit = credittemp * 0.75;
    						else if (stu.sco.ch.overal < 70 && stu.sco.ch.overal >= 60) stu.sco.ch.real_credit = credittemp * 0.6;
    						else stu.sco.ch.real_credit = 0;
    					}; break;
    					case 'B':
    					{
    						stu.sco.ma.has = true;
    						strcpy(stu.sco.ma.credit, credit);
    						strcpy(stu.sco.ma.daily, daily);
    						strcpy(stu.sco.ma.experi, experi);
    						strcpy(stu.sco.ma.paper, paper);
    						float credittemp;
    						if (credit[2] == '0') credittemp = 100;
    						else if (credit[1] != '\0')
    							credittemp = ((int)credit[0] - 48) * 10 + (int)credit[1] - 48;
    						else credittemp = (int)credit[0] - 48;
    						float dailytemp, papertemp, experitemp;
    						if (daily[2] == '0') dailytemp = 100;
    						else if (daily[1] != '\0')
    							dailytemp = ((int)daily[0] - 48) * 10 + (int)daily[1] - 48;
    						else dailytemp = (int)daily[0] - 48;
    						if (paper[2] == '0') papertemp = 100;
    						else if (paper[1] != '\0')
    							papertemp = ((int)paper[0] - 48) * 10 + (int)paper[1] - 48;
    						else papertemp = (int)paper[0] - 48;
    						if (strcmp(experi, "-1") == 0)
    						{
    							stu.sco.ma.overal = dailytemp * 0.3 + papertemp * 0.7;
    						}
    						else
    						{
    							if (experi[2] == '0') experitemp = 100;
    							else if (experi[1] != '\0')
    								experitemp = ((int)experi[0] - 48) * 10 + (int)experi[1] - 48;
    							else experitemp = (int)experi[0] - 48;
    							stu.sco.ma.overal = dailytemp * 0.15 + experitemp * 0.15 + papertemp * 0.7;
    						}
    						if (stu.sco.ma.overal >= 90 && stu.sco.ma.overal <= 100)
    							stu.sco.ma.real_credit = credittemp;
    						else if (stu.sco.ma.overal < 90 && stu.sco.ma.overal >= 80) stu.sco.ma.real_credit = credittemp * 0.8;
    						else if (stu.sco.ma.overal < 80 && stu.sco.ma.overal >= 70) stu.sco.ma.real_credit = credittemp * 0.75;
    						else if (stu.sco.ma.overal < 70 && stu.sco.ma.overal >= 60) stu.sco.ma.real_credit = credittemp * 0.6;
    						else stu.sco.ma.real_credit = 0;
    					}; break;
    					case 'C':
    					{
    						stu.sco.en.has = true;
    						strcpy(stu.sco.en.credit, credit);
    						strcpy(stu.sco.en.daily, daily);
    						strcpy(stu.sco.en.experi, experi);
    						strcpy(stu.sco.en.paper, paper);
    						float credittemp;
    						if (credit[2] == '0') credittemp = 100;
    						else if (credit[1] != '\0')
    							credittemp = ((int)credit[0] - 48) * 10 + (int)credit[1] - 48;
    						else credittemp = (int)credit[0] - 48;
    						float dailytemp, papertemp, experitemp;
    						if (daily[2] == '0') dailytemp = 100;
    						else if (daily[1] != '\0')
    							dailytemp = ((int)daily[0] - 48) * 10 + (int)daily[1] - 48;
    						else dailytemp = (int)daily[0] - 48;
    						if (paper[2] == '0') papertemp = 100;
    						else if (paper[1] != '\0')
    							papertemp = ((int)paper[0] - 48) * 10 + (int)paper[1] - 48;
    						else papertemp = (int)paper[0] - 48;
    						if (strcmp(experi, "-1") == 0)
    						{
    							stu.sco.en.overal = dailytemp * 0.3 + papertemp * 0.7;
    						}
    						else
    						{
    							if (experi[2] == '0') experitemp = 100;
    							else if (experi[1] != '\0')
    								experitemp = ((int)experi[0] - 48) * 10 + (int)experi[1] - 48;
    							else experitemp = (int)experi[0] - 48;
    							stu.sco.en.overal = dailytemp * 0.15 + experitemp * 0.15 + papertemp * 0.7;
    						}
    						if (stu.sco.en.overal >= 90 && stu.sco.en.overal <= 100)
    							stu.sco.en.real_credit = credittemp;
    						else if (stu.sco.en.overal < 90 && stu.sco.en.overal >= 80) stu.sco.en.real_credit = credittemp * 0.8;
    						else if (stu.sco.en.overal < 80 && stu.sco.en.overal >= 70) stu.sco.en.real_credit = credittemp * 0.75;
    						else if (stu.sco.en.overal < 70 && stu.sco.en.overal >= 60) stu.sco.en.real_credit = credittemp * 0.6;
    						else stu.sco.en.real_credit = 0;
    					}; break;
    					case 'D':
    					{
    						stu.sco.pe.has = true;
    						strcpy(stu.sco.pe.credit, credit);
    						strcpy(stu.sco.pe.daily, daily);
    						strcpy(stu.sco.pe.experi, experi);
    						strcpy(stu.sco.pe.paper, paper);
    						float credittemp;
    						if (credit[2] == '0') credittemp = 100;
    						else if (credit[1] != '\0')
    							credittemp = ((int)credit[0] - 48) * 10 + (int)credit[1] - 48;
    						else credittemp = (int)credit[0] - 48;
    						float dailytemp, papertemp, experitemp;
    						if (daily[2] == '0') dailytemp = 100;
    						else if (daily[1] != '\0')
    							dailytemp = ((int)daily[0] - 48) * 10 + (int)daily[1] - 48;
    						else dailytemp = (int)daily[0] - 48;
    						if (paper[2] == '0') papertemp = 100;
    						else if (paper[1] != '\0')
    							papertemp = ((int)paper[0] - 48) * 10 + (int)paper[1] - 48;
    						else papertemp = (int)paper[0] - 48;
    						if (strcmp(experi, "-1") == 0)
    						{
    							stu.sco.pe.overal = dailytemp * 0.3 + papertemp * 0.7;
    						}
    						else
    						{
    							if (experi[2] == '0') experitemp = 100;
    							else if (experi[1] != '\0')
    								experitemp = ((int)experi[0] - 48) * 10 + (int)experi[1] - 48;
    							else experitemp = (int)experi[0] - 48;
    							stu.sco.pe.overal = dailytemp * 0.15 + experitemp * 0.15 + papertemp * 0.7;
    						}
    						if (stu.sco.pe.overal >= 90 && stu.sco.pe.overal <= 100)
    							stu.sco.pe.real_credit = credittemp;
    						else if (stu.sco.pe.overal < 90 && stu.sco.pe.overal >= 80) stu.sco.pe.real_credit = credittemp * 0.8;
    						else if (stu.sco.pe.overal < 80 && stu.sco.pe.overal >= 70) stu.sco.pe.real_credit = credittemp * 0.75;
    						else if (stu.sco.pe.overal < 70 && stu.sco.pe.overal >= 60) stu.sco.pe.real_credit = credittemp * 0.6;
    						else stu.sco.pe.real_credit = 0;
    					}; break;
    					case 'E':
    					{
    						stu.sco.se.has = true;
    						strcpy(stu.sco.se.credit, credit);
    						strcpy(stu.sco.se.daily, daily);
    						strcpy(stu.sco.se.experi, experi);
    						strcpy(stu.sco.se.paper, paper);
    						float credittemp;
    						if (credit[2] == '0') credittemp = 100;
    						else if (credit[1] != '\0')
    							credittemp = ((int)credit[0] - 48) * 10 + (int)credit[1] - 48;
    						else credittemp = (int)credit[0] - 48;
    						float dailytemp, papertemp, experitemp;
    						if (daily[2] == '0') dailytemp = 100;
    						else if (daily[1] != '\0')
    							dailytemp = ((int)daily[0] - 48) * 10 + (int)daily[1] - 48;
    						else dailytemp = (int)daily[0] - 48;
    						if (paper[2] == '0') papertemp = 100;
    						else if (paper[1] != '\0')
    							papertemp = ((int)paper[0] - 48) * 10 + (int)paper[1] - 48;
    						else papertemp = (int)paper[0] - 48;
    						if (strcmp(experi, "-1") == 0)
    						{
    							stu.sco.se.overal = dailytemp * 0.3 + papertemp * 0.7;
    						}
    						else
    						{
    							if (experi[2] == '0') experitemp = 100;
    							else if (experi[1] != '\0')
    								experitemp = ((int)experi[0] - 48) * 10 + (int)experi[1] - 48;
    							else experitemp = (int)experi[0] - 48;
    							stu.sco.se.overal = dailytemp * 0.15 + experitemp * 0.15 + papertemp * 0.7;
    						}
    						if (stu.sco.se.overal >= 90 && stu.sco.se.overal <= 100)
    							stu.sco.se.real_credit = credittemp;
    						else if (stu.sco.se.overal < 90 && stu.sco.se.overal >= 80) stu.sco.se.real_credit = credittemp * 0.8;
    						else if (stu.sco.se.overal < 80 && stu.sco.se.overal >= 70) stu.sco.se.real_credit = credittemp * 0.75;
    						else if (stu.sco.se.overal < 70 && stu.sco.se.overal >= 60) stu.sco.se.real_credit = credittemp * 0.6;
    						else stu.sco.se.real_credit = 0;
    					}
    					//已经全部存入stu
    					}
    					fseek(fp, -240L, 1);
    					fwrite(&stu, 240, 1, fp);
    					float finalcredit = 0;
    					int n = 0;
    					printf("修改如下:");
    					printf("\n学号:%-15s姓名:%-s\n\n", stu.basic.id, stu.basic.name);
    					if (stu.sco.ch.has)
    					{
    						printf("课程编号:A    课程名称:语文    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.ch.overal, stu.sco.ch.real_credit); n++;
    						finalcredit = finalcredit + stu.sco.ch.real_credit;
    					}
    					if (stu.sco.ma.has)
    					{
    						printf("课程编号:B    课程名称:数学    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.ma.overal, stu.sco.ma.real_credit); n++;
    						finalcredit = finalcredit + stu.sco.ma.real_credit;
    					}
    					if (stu.sco.en.has)
    					{
    						printf("课程编号:C    课程名称:英语    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.en.overal, stu.sco.en.real_credit); n++;
    						finalcredit = finalcredit + stu.sco.en.real_credit;
    					}
    					if (stu.sco.pe.has)
    					{
    						printf("课程编号:D    课程名称:体育    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.pe.overal, stu.sco.pe.real_credit); n++;
    						finalcredit = finalcredit + stu.sco.pe.real_credit;
    					}
    					if (stu.sco.se.has)
    					{
    						printf("课程编号:E    课程名称:专业    综合成绩:%-10.2f实得学分:%-10.2f\n", stu.sco.se.overal, stu.sco.se.real_credit); n++;
    						finalcredit = finalcredit + stu.sco.se.real_credit;
    					}
    					printf("\n\t\t\t\t   共修:%d科   实得总学分为:%.2f\n\n", n, finalcredit);
    					printf("***********************************************************************************************************************\n");
    				}
    		}
    		rewind(fp);
    	}
    	fcloseall();
    	Paint_Start();
    }
    //判断是否为数字
    int ifnum(char item[])//数字字符串判断,正确返回1,否则0
    {
    	bool isnum = true;
    	for (int i = 0; item[i] != '\0'; i++)
    	{
    		if (!(item[i] >= '0' && item[i] <= '9'))
    		{
    			isnum = false;
    			return 0;
    			break;
    		}
    	}
    	if(isnum) return 1;
    }
    //结束动画
    void end()
    {
    	system("cls");
    	printf("\n\n\n\t\t\t\t\t                 *\n");
    	printf("\t\t\t\t\t            *  ***  ****\n");
    	printf("\t\t\t\t\t          *** **** ****\n");
    	printf("\t\t\t\t\t         **** **** **** ****\n");
    	printf("\t\t\t\t\t         **** **** **** ****\n");
    	printf("\t\t\t\t\t         **** **** **** ****\n");
    	printf("\t\t\t\t\t         **** **** **** ****\n");
    	printf("\t\t\t\t\t         **** **** **** ****\n");
    	printf("\t\t\t\t\t          **** ******* ****\n");
    	printf("\t\t\t\t\t            *************\n");
    	printf("\t\t\t\t\t                *****\n\n");
    	Sleep(800);
    	system("cls");
    	printf("\n\n\n\t\t\t\t\t                 *\n");
    	printf("\t\t\t\t\t               ***  ****\n");
    	printf("\t\t\t\t\t            * **** ****\n");
    	printf("\t\t\t\t\t          *** **** **** \n");
    	printf("\t\t\t\t\t         **** **** **** ****\n");
    	printf("\t\t\t\t\t         **** **** **** ****\n");
    	printf("\t\t\t\t\t         **** **** **** ****\n");
    	printf("\t\t\t\t\t         **** **** **** ****\n");
    	printf("\t\t\t\t\t         ****  *******  ****   \n");
    	printf("\t\t\t\t\t          ****         ****\n");
    	printf("\t\t\t\t\t            *************\n");
    	printf("\t\t\t\t\t                *****\n\n");
    	Sleep(100);
    	system("cls");
    	printf("\n\n\n\t\t\t\t\t                 *\n");
    	printf("\t\t\t\t\t               ***  ****\n");
    	printf("\t\t\t\t\t              **** ****\n");
    	printf("\t\t\t\t\t            * **** **** \n");
    	printf("\t\t\t\t\t          *** **** **** \n");
    	printf("\t\t\t\t\t         **** **** **** ****\n");
    	printf("\t\t\t\t\t         **** **** **** ****\n");
    	printf("\t\t\t\t\t         **** **** **** ****\n");
    	printf("\t\t\t\t\t         ****  *******  ****   \n");
    	printf("\t\t\t\t\t         ****  感   谢  ****   \n");
    	printf("\t\t\t\t\t          ****         ****\n");
    	printf("\t\t\t\t\t            *************\n");
    	printf("\t\t\t\t\t                *****\n\n");
    	Sleep(100);
    	system("cls");
    	printf("\n\n\n\t\t\t\t\t                 *\n");
    	printf("\t\t\t\t\t               ***  ****\n");
    	printf("\t\t\t\t\t              **** ****\n");
    	printf("\t\t\t\t\t              **** **** \n");
    	printf("\t\t\t\t\t            * **** ****\n");
    	printf("\t\t\t\t\t          *** **** **** \n");
    	printf("\t\t\t\t\t         **** **** **** ****\n");
    	printf("\t\t\t\t\t         **** **** **** ****\n");
    	printf("\t\t\t\t\t         ****  *******  ****   \n");
    	printf("\t\t\t\t\t         ****           ****   \n");
    	printf("\t\t\t\t\t         ****  感   谢  ****   \n");
    	printf("\t\t\t\t\t          ****         ****\n");
    	printf("\t\t\t\t\t            *************\n");
    	printf("\t\t\t\t\t                *****\n\n");
    	Sleep(100);
    	system("cls");
    	printf("\n\n\n\t\t\t\t\t                 *\n");
    	printf("\t\t\t\t\t               ***  ****\n");
    	printf("\t\t\t\t\t              **** ****\n");
    	printf("\t\t\t\t\t              **** **** \n");
    	printf("\t\t\t\t\t            * **** ****\n");
    	printf("\t\t\t\t\t          *** **** **** \n");
    	printf("\t\t\t\t\t         **** **** **** ****\n");
    	printf("\t\t\t\t\t         **** **** **** ****\n");
    	printf("\t\t\t\t\t         ****  *******  ****   \n");
    	printf("\t\t\t\t\t         ****  感   谢  ****   \n");
    	printf("\t\t\t\t\t         ****           ****   \n");
    	printf("\t\t\t\t\t          **** 使   用 ****\n");
    	printf("\t\t\t\t\t            *************\n");
    	printf("\t\t\t\t\t                *****\n\n");
    	Sleep(2000);
    }
    

    总结

    1.编写过程中遇到很多问题,比如fclose关闭文件流,至今未搞明白,只有一个fp文件指针变量的信息查询,无论在哪调用fclose,无论调用多少次fclose,都无法关闭文件流,导致文件被进程占用,无法进行删除和替换,最终用fcloseall解决了,很奇怪。
    2.冗余代码要删除,它们很容易干扰你的的思路。
    3.输入时,缓冲区问题要注意。
    4.仍然是case后忘加break问题,需要细心。
    5.坐的时间长一定要出去走走,头脑清醒了思路来得更快,效率更高。

    展开全文
  • c语言程序设计课设 课程设计目的 进一步掌握和利用 C 语言进行程设计的能力; 进一步理解和运用结构化程设计的思想和方法; 初步掌握开发一个小型实用系统的基本方法; 学会调试一个较长程序的基本方法; 学会利用...
  • 学生管理系统 (:只录入每个学生的学号、课程编号、课程名称、学分、平时成绩、实验成绩、卷面成绩共7个数据. 综合成绩、学分由程序根据条件自动运算。 (2)查询功能:分为学生基本情况查询和成绩查询两种 A:...
  • 电院财经之声山东电子职业技术学院财经金融系根据我校《学分制改革实施方案》(鲁电职院教字〔2019〕69号)和《“十三五”素质教育工程实施方案...《学生“第二课堂”素质教育学分管理办法》(鲁电职院学字〔2020〕3号)...
  • 编写一个程序对学生的课程选修进行管理系统能实现以下功能:  添加:添加课程或学生记录,可提供选择所要添加类别的选择界面,要求编号要唯一,如果添加了重复编号的记录时,则提示数据添加重复并取消添加; ...
  • 学生选课管理系统 用顺序表实现 ◆问题描述  设计一个计算机管理完成的学生选课信息基本业务。 ◆要求 课程信息包括:课程编号、课程名称、课程性质、总学时、学分、课程人数上限。 选课信息包括:学号、姓名、...
  • 要求:使用下面的数据,用C语言设计一个简单的学籍管理系统,实现出最基本的功能。 学生基本信息文件(A.TXT)及其内容:A.TXT文件不需要编程录入数据,可用文本编辑工具直接生成: 学号 姓名 性别 宿舍号码 电话...
  • 在网上可以查找到不少学生成绩管理系统的实现方法,但本文是基于C++,应用链表和类的方法来实现,并且用泛型编程的思路使得链表的实现比C语言实现起来简单很多,下面是实验的简单介绍。   一、学生成绩管理系统...
  • 学生教务系统

    2012-07-31 15:38:03
    设计一个教务信息管理系统,该程序具有以下功能: (1)录入如下信息: 学生基本信息:如学号、姓名、性别、年龄、宿舍号码、电话号码等。 课程基本信息:课程编号、课程名称、考试成绩、平时成绩、综合成绩、学分...
  • 学生公共选修课管理系统 一、 功能需求说明(必须采用结构体和动态链表实现) (1)用户登录与主界面模块。负责用户登录窗口的生成、用户名以及用户密码的输入与确认。 (2)输入模块。涉及...
  • printf(" 欢迎使用毕业设计选题管理系统! \n"); printf(" 1-浏览选题信息 2-查询选题信息\n"); printf(" 3-进入选题操作 4-选题情况统计\n"); printf(" 5-录入选题信息 0-退出选题系统\n"); printf(" 请选择...
  • 现在我还是个大学生,当初上大学的时候本来想去计算机系统,没想到分数不够,去了管理学院,学的是管理科学与工程。但不得不说,编程着实是覆盖到各个学科的方方面面,凡是和大数据啊,计算机啊沾点边的专业,...
  • 疯狂的程序员

    热门讨论 2012-07-18 18:05:32
    比如大家都在说“TMD”,“NMD”,你跟他们说:“‘TMD’是‘战区导弹防御系统’,‘NMD’是‘国家导弹防御系统’。”这样保证引起别人的注意。现在的社会就是,谁吸引了眼球,谁就吸引了Money。 绝影又去上了2次课...

空空如也

空空如也

1 2
收藏数 26
精华内容 10
关键字:

学生学分管理系统c语言

c语言 订阅