学生管理系统(C语言)(Easy-x)

     

                                                          课 程  名 称:     程序设计实践             

                                                          专     XXXXX XXXXX          

                                                          学      XXX                            

                                                          学       号      231040700302              

                                                          任     XXX                            

                                                          学       期 :XXXX-XXXX学年第X学期   

                                                        课程报告任务书

 

学生成绩管理系统

主要

内容

用C语言开发一个简单的学生成绩管理系统。实现学生信息管理,并且有界面和跳转。
【数据结构】
1.学生成绩信息。包括:学号,姓名,成绩。
2.登陆账号信息。包括:密码、 权限级别(区别系统管理员用户和普通用户)。
3.学生个人信息。包括:学号,姓名,性别,学院,专业,联系方式。
【系统实现功能】
1.系统登陆
  使用登陆账号和密码登陆,判断用户编号和密码是否一致,正确,则根据角色不同显示不同的界面。管理员显示管理员菜单。普通用户显示普通用户界面。
2.系统管理员
(1)学生信息管理:学生信息和成绩的增、删、改、查功能。
(2)全部展示所有学生的信息和成绩在一个交互界面上。
3. 普通用户(学生)
(1)学生可以注册自己的个人信息。
(2)学生可以根据自己的学号查询自己的个人信息和成绩。

任务

要求

一、提交材料应包括:

(1)系统源代码

(2)课程报告

二、整个设计过程具体要求

(1)需求分析

要求学生对案例系统进行分析,设计出需要完成的功能,完善各个模块的调用关系;要有系统结构图

(2)设计过程

要求学生进一步明确各模块调用关系,进一步完善模块函数细节(函数名、参数、返回值等),至少有一个关键模块的流程图。

(3)实现过程

要求学生养成良好的编码习惯、完成各个模块并进行测试,最终完成系统整体测试;

(4)总结阶段

按照要求完成系统设计和实现报告,并进行总结。

 

目录

一、需求分析. .........................................3

二、概要设计.......................................... 3

三、详细设计. .........................................4

(一)函数变量名的定义.................. 4

(二)功能函数模块展示. .................6

(三)主函数.................................... 6

(四)管理员界面............................. 7

(五)管理员.................................... 8

(六)首页学分表............................. 9

(七)次页学分表. ..........................12

(八)尾页学分表. ..........................13

(九)首页学生信息表................... .14

(十)次页学生信息表................... .16

(十一)尾页学生信息表.................18

(十二)对学生数据进行操作. ........19

(十三)录入学生信息.................... 20

(十四)删除学生信息.....................29

(十五)查找学生信息.....................34

(十六)修改学生信息.....................37

(十七)学生窗口. .................... .....45

(十八)载入学生数目. ...................46

(十九)存储学生数目.....................46

(二十)学生注册. .................... .....46

(二十一)学生登录..................... .. 52

四、调试分析..................... ....................55

五、测试结果..................... ....................55

六、课程心得总结. .................... ............61

七、参考文献. .................... ...................61

一、需求分析

学生基本信息和学生学分信息动态化绑定,管理员与学生操作相结合的学生信息管理系统,与此同时丰富了一些界面的跳转和防止用户错误输入的提醒。

二、概要设计

总览流程图,如图1-1所示,进入首页后,可以选择进入管理员界面或者学生操作界面。进入管理员界面后,可以选择所有学生的数据或者对他们的数据进行增删查改。进入学生操作界面后,可以选择学生登录和学生注册。

图1-1 总流程图

管理员展示流程图,如图2-1所示,进入管理员界面后,可以显示所有学生的学分表和信息表,也可以对他们的数据进行增加,删除,修改,查询的操作。

图2-1 管理员流程图

学生界面流程图,如图3-1所示,进入学生界面,可以选择学生登录或者注册,如果你登录没有注册的学号信息的话,会跳转到注册页面去完成相应的注册操作。

图3-1 学生流程图

三、详细设计

(一)函数变量名的定义

#include <stdio.h>

#include<stdlib.h>

#include<string.h>

#include<graphics.h>

#define RecordNums 42//结构体数组数量——可以记录学生数据最大容量

#define Transverse 173//信息表格横向

#define longitudinal 38//信息表格纵向

#define Transverse_s 145//学分表格横向

#define longitudinal_s 39//学分表格纵向

typedef struct Student//学生信息结构体定义

{

    char s_studentID[15];//学号

    char s_Name[15];//姓名

    char s_gender[15];//性别

    char s_faculty[15];//院系

    char s_speciality[15];//专业

    char s_grade[15];//年级

    char s_number[15];//手机号

}Student;

typedef struct Score//学生学分结构体定义

{

    char studentID[15];//学号

    char Name[15];//姓名

    char compulsory[6];//必修

    char select[6];//选修

    char morality[6];//德育

    char innovate[6];//创新

    char other[6];//其它

    char sum[6];//总和

}Score;

typedef struct app//学生信息缓冲结构体

{

    char s_studentID[15];//学号

    char s_Name[15];//姓名

    char s_gender[15];//性别

    char s_faculty[15];//院系

    char s_speciality[15];//专业

    char s_grade[15];//年级

    char s_number[15];//手机号

}app;

typedef struct add//学生学分缓冲结构体

{

    char studentID[15];//学号

    char Name[15];//姓名

    char compulsory[6];//必修

    char select[6];//选修

    char morality[6];//德育

    char innovate[6];//创新

    char other[6];//其它

    char sum[6];//总和

}add;

(二)功能函数模块展示

void main();//主窗口

void password();//管理员认证

void managewindows();//管理员

void summary();//对学生数据进行操作

void information_homepage();//首页学生信息表

void information_secondarypage();//次页学生信息表

void credit_homepage();//首页学分表

void credit_secondarypage();//次页学分表

void information_secondarypage_final();//尾页学生信息表

void credit_secondarypage_final();//尾页学生学分表

void increase();//录入学生信息

void erasure();//删除学生信息

void view();//查找学生信息

void correct();//修改学生信息

void studentwindows();//学生窗口

void student_registration();//学生注册

void student_login();// 学生登录

(三)主函数

void main()//主窗口的建立

{

    initgraph(1280, 720);

    IMAGE host_a;

    loadimage(&host_a, "E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\界面图片\\首页.png", 1280,720);

    HWND hnd = GetHWnd();

    SetWindowText(hnd, "学生信息管理系统");

    putimage(0, 0, &host_a);

    settextcolor(WHITE);//设置字体颜色为白色

    setbkmode(TRANSPARENT);//消除字体背景颜色

    settextstyle(40,0,_T("Consolas"));//设置字体大小

    while (1)//时刻获取鼠标信息

    {

        if (MouseHit())//如果有消息

        {

            MOUSEMSG host_b = GetMouseMsg();//设置变量引入消息

            switch (host_b.uMsg)//判断是什么信息

            {

            case WM_LBUTTONDOWN://左键

                if (host_b.x > 667.02 && host_b.x < 854.47 && host_b.y>401.39 && host_b.y < 454.68)

                {

                    password();//进入管理员界面

                    break;

                }

                else if (host_b.x > 683.65 && host_b.x< 837.08 && host_b.y> 500.50 && host_b.y < 600.17)

                {

                    studentwindows();//进入学生界面

                    break;

                }

            }

        }

    }

}

全局变量:

int nowstudentnums=0;//学生信息数据个数

//int num = 0;//统计学生人数

char code[20] = "666666";//管理员密码

int interdict=0;//阻断循环变量

Student information[RecordNums];//创建学生信息结构体数组

Score credit[RecordNums];//创建学生学分结构体数组

app information_buffer;//创建学生信息缓冲结构体

add credit_buffer;//创建学生学分缓冲结构体

(四)管理员界面

void password()//管理员认证

{

    char password_a[15];

    TCHAR password_s[] = _T("输入管理员密码");

    InputBox(password_a, 15, password_s);

    if (strcmp(code, password_a) == 0)

    {

        managewindows();

    }

    else

    {

        HWND hnd = GetHWnd();

        int isok=MessageBox(hnd, "输入密码错误,请重新输入", "错误提示", MB_OKCANCEL);

        if (isok == IDOK)

        {

            password();

        }

        else if (IDCANCEL == isok)

        {

            main();

        }

    }

}

(五)管理员

void managewindows()//管理员

{

    IMAGE manage_a;

    loadimage(&manage_a, "E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\界面图片\\管理员操作界面.png", 1280,720);

    putimage(0, 0, &manage_a);

    FILE* informationfile_s;//定义存取学生信息文件指针

    FILE* creditfile_s;//定义存取学分信息文件指针

    //打开文档进行分析操作

    informationfile_s = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生信息.txt", "r+");

    creditfile_s = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生学分.txt", "r+");

    //提取学生学分数据

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

    {

        //判断数据是否读完

        if (feof(creditfile_s) == 1)//informationfile_s

        {

            break;

        }

        //将文件数据保存在结构数组中

        fscanf(informationfile_s, "%s %s %s %s %s %s %s\n",

            information[i].s_studentID,

            information[i].s_Name,

            information[i].s_gender,

            information[i].s_faculty,

            information[i].s_speciality,

            information[i].s_grade,

            information[i].s_number);

        fscanf(creditfile_s, "%s %s %s %s %s %s %s %s\n",

            credit[i].studentID,

            credit[i].Name,

            credit[i].compulsory,

            credit[i].select,

            credit[i].morality,

            credit[i].innovate,

            credit[i].other,

            credit[i].sum);

    }

    fclose(informationfile_s);//关闭文件

    fclose(creditfile_s);//关闭文件

    while (1)//时刻获取鼠标信息

    {

        if (MouseHit())//如果有消息

        {

            MOUSEMSG manage_b = GetMouseMsg();//设置变量引入消息

            switch (manage_b.uMsg)//判断是什么信息

            {

            case WM_LBUTTONDOWN://左键

                if (manage_b.x > 703.68 && manage_b.x < 1038.89 && manage_b.y>351.12 && manage_b.y < 410.83)

                {

                    credit_homepage();//首页学分表

                    break;

                }

                else if (manage_b.x >681.00 && manage_b.x <1054.38&& manage_b.y>507.21 && manage_b.y < 567.31)

                {

                    summary();//对学生数据进行操作

                    break;

                }

                else if (manage_b.x > 21.92 && manage_b.x < 122.82 && manage_b.y>19.28 && manage_b.y < 80.88)

                {

                    main();//主窗口

                    break;

                }

          

            }

        }

    }

}

(六)首页学分表

void credit_homepage()//首页学分表

{

    IMAGE creditpicture_s;//定义界面图片指针

    loadimage(&creditpicture_s, "E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\界面图片\\首页学生学分表.png", 1280, 720);

    putimage(0, 0, &creditpicture_s);

    settextstyle(25, 0, _T("Consolas"));//设置字体大小

    settextcolor(BLACK);//设置字体颜色为黑色

    setbkmode(TRANSPARENT);//消除字体背景颜色

    //冒泡排序法——总分排序

    int i = 0, j;

    for (i; i < nowstudentnums; i++)

    {

        for (j = 0; j < nowstudentnums - i - 1; j++)

        {

            if (atof(credit[j].sum) > atof(credit[j + 1].sum))

            {

                strcpy(credit_buffer.sum, credit[j].sum);

                strcpy(credit[j].sum, credit[j + 1].sum);

                strcpy(credit[j + 1].sum, credit_buffer.sum);

                strcpy(credit_buffer.studentID, credit[j].studentID);

                strcpy(credit[j].studentID, credit[j + 1].studentID);

                strcpy(credit[j + 1].studentID, credit_buffer.studentID);

                strcpy(credit_buffer.Name, credit[j].Name);

                strcpy(credit[j].Name, credit[j + 1].Name);

                strcpy(credit[j + 1].Name, credit_buffer.Name);

                strcpy(credit_buffer.compulsory, credit[j].compulsory);

                strcpy(credit[j].compulsory, credit[j + 1].compulsory);

                strcpy(credit[j + 1].compulsory, credit_buffer.compulsory);

                strcpy(credit_buffer.select, credit[j].select);

                strcpy(credit[j].select, credit[j + 1].select);

                strcpy(credit[j + 1].select, credit_buffer.select);

                strcpy(credit_buffer.morality, credit[j].morality);

                strcpy(credit[j].morality, credit[j + 1].morality);

                strcpy(credit[j + 1].morality, credit_buffer.morality);

                strcpy(credit_buffer.innovate, credit[j].innovate);

                strcpy(credit[j].innovate, credit[j + 1].innovate);

                strcpy(credit[j + 1].innovate, credit_buffer.innovate);

                strcpy(credit_buffer.other, credit[j].other);

                strcpy(credit[j].other, credit[j + 1].other);

                strcpy(credit[j + 1].other, credit_buffer.other);

            }

        }

    }

    //输出数据

    for (int b = 0; b < 14; b++)

    {

        //将结构数组中数据输出到主表格

        outtextxy(63, 113 + b * longitudinal_s, credit[b].studentID);

        outtextxy(245, 113 + b * longitudinal_s, credit[b].Name);

        outtextxy(352, 113 + b * longitudinal_s, credit[b].compulsory);

        outtextxy(352+Transverse_s, 113 + b * longitudinal_s, credit[b].select);

        outtextxy(352 +2 * Transverse_s , 113+ b * longitudinal_s, credit[b].morality);

        outtextxy(352 + 3 * Transverse_s, 113 + b * longitudinal_s, credit[b].innovate);

        outtextxy(352 +4 * Transverse_s , 113 + b * longitudinal_s, credit[b].other);

        outtextxy(352 + 5* Transverse_s, 113 + b * longitudinal_s, credit[b].sum);

    }

    //按键的响应

    while (1)//时刻获取鼠标信息

    {

        if (MouseHit())//如果有消息

        {

            MOUSEMSG credit_s = GetMouseMsg();//设置变量引入消息

            switch (credit_s.uMsg)//判断是什么信息

            {

            case WM_LBUTTONDOWN://左键

                //(返回)按钮

                if (credit_s.x > 21.54 && credit_s.x < 102.04 && credit_s.y>661.42 && credit_s.y < 706.39)

                {

                    managewindows();//管理员界面

                    break;

                }

                //(显示学生基本信息)按钮

                else if (credit_s.x > 915.69 && credit_s.x < 1094.07 && credit_s.y>661.8 && credit_s.y < 706.39)

                {

                    information_homepage();//首页学生信息表

                    break;

                }

                //(下一页)按钮

                else if (credit_s.x > 1114.1 && credit_s.x < 1221.42 && credit_s.y>661.8 && credit_s.y < 706.39)

                {

                    credit_secondarypage();//次页学分表

                    break;

                }

            }

        }

    }

}

(七)次页学分表

void credit_secondarypage()//次页学分表

{

    IMAGE creditpicture_c;//定义界面图片指针

    loadimage(&creditpicture_c, "E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\界面图片\\次页学生学分表.png", 1280, 720);

    putimage(0, 0, &creditpicture_c);

    settextstyle(25, 0, _T("Consolas"));//设置字体大小

    settextcolor(WHITE);//设置字体颜色为白色

    setbkmode(TRANSPARENT);//消除字体背景颜色

    int a = 0;

    //输出数据

    for (int b = 14; b < 28; b++)

    {

        if (strlen(credit[b].studentID) == 0)

        {

            break;

        }

        //将结构数组中数据输出到主表格

        outtextxy(63, 84 + a * longitudinal_s, credit[b].studentID);

        outtextxy(245, 84 + a * longitudinal_s, credit[b].Name);

        outtextxy(352, 84 + a * longitudinal_s, credit[b].compulsory);

        outtextxy(352 + Transverse_s, 84 + a * longitudinal_s, credit[b].select);

        outtextxy(352 + 2 * Transverse_s, 84 + a * longitudinal_s, credit[b].morality);

        outtextxy(352 + 3 * Transverse_s, 84+ a * longitudinal_s, credit[b].innovate);

        outtextxy(352 + 4 * Transverse_s, 84 + a * longitudinal_s, credit[b].other);

        outtextxy(352 + 5 * Transverse_s, 84+ a * longitudinal_s, credit[b].sum);

        a++;

    }

    //按键的响应

    while (1)//时刻获取鼠标信息

    {

        if (MouseHit())//如果有消息

        {

            MOUSEMSG credit_c = GetMouseMsg();//设置变量引入消息

            switch (credit_c.uMsg)//判断是什么信息

            {

            case WM_LBUTTONDOWN://左键

                //(上一页)按钮

                if (credit_c.x > 973.51 && credit_c.x < 1074.04 && credit_c.y>650.83 && credit_c.y < 696.19)

                {

                    credit_homepage();//首页学分表

                    break;

                }

                //(下一页)按钮

                else if (credit_c.x > 1107.29 && credit_c.x < 1213.49 && credit_c.y>650.83 && credit_c.y < 696.19)

                {

                    credit_secondarypage_final();//尾页学生学分表

                    break;

                }

            }

        }

    }

}

(八)尾页学分表

void credit_secondarypage_final()//尾页学生学分表

{

    IMAGE creditpicture_w;//定义界面图片指针

    loadimage(&creditpicture_w, "E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\界面图片\\尾页学生学分表.png", 1280, 720);

    putimage(0, 0, &creditpicture_w);

    settextstyle(25, 0, _T("Consolas"));//设置字体大小

    settextcolor(BLACK);//设置字体颜色为黑色

    setbkmode(TRANSPARENT);//消除字体背景颜色

    int a = 0;

    //输出数据

    for (int b = 28; b < 42; b++)

    {

        if (strlen(credit[b].studentID)==0)

        {

            break;

        }

        //将结构数组中数据输出到主表格

        outtextxy(63, 84 + a * longitudinal_s, credit[b].studentID);

        outtextxy(245, 84 + a * longitudinal_s, credit[b].Name);

        outtextxy(352, 84 + a * longitudinal_s, credit[b].compulsory);

        outtextxy(352 + Transverse_s, 84 + a * longitudinal_s, credit[b].select);

        outtextxy(352 + 2 * Transverse_s, 84 + a * longitudinal_s, credit[b].morality);

        outtextxy(352 + 3 * Transverse_s, 84 + a * longitudinal_s, credit[b].innovate);

        outtextxy(352 + 4 * Transverse_s, 84 + a * longitudinal_s, credit[b].other);

        outtextxy(352 + 5 * Transverse_s, 84 + a * longitudinal_s, credit[b].sum);

        a++;

    }

    //按键的响应

    while (1)//时刻获取鼠标信息

    {

        if (MouseHit())//如果有消息

        {

            MOUSEMSG credit_w = GetMouseMsg();//设置变量引入消息

            switch (credit_w.uMsg)//判断是什么信息

            {

            case WM_LBUTTONDOWN://左键

                //(上一页)按钮

                if (credit_w.x > 1120.52 && credit_w.x < 1219.91 && credit_w.y>649.7 && credit_w.y < 693.92)

                {

                    credit_secondarypage();//次页学分表

                    break;

                }

            }

        }

    }

}

(九)首页学生信息表

void information_homepage()//首页学生信息表

{

    IMAGE informationpicture_s;//定义界面图片指针

    loadimage(&informationpicture_s, "E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\界面图片\\首页学生信息表.png", 1280, 720);

    putimage(0, 0, &informationpicture_s);

    settextstyle(25, 0, _T("Consolas"));//设置字体大小

    settextcolor(BLACK);//设置字体颜色为黑色

    setbkmode(TRANSPARENT);//消除字体背景颜色

     UseStudentNumber();//载入学生数目

    //冒泡排序法——学号排序

    int i = 0, j;

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

    {

        for (j = 0; j < nowstudentnums - i - 1; j++)

        {

            if (atof(information[j].s_studentID) > atof(information[j + 1].s_studentID))

            {

                strcpy(information_buffer.s_studentID, information[j].s_studentID);

                strcpy(information[j].s_studentID, information[j + 1].s_studentID);

                strcpy(information[j + 1].s_studentID, information_buffer.s_studentID);

                strcpy(information_buffer.s_Name, information[j].s_Name);

                strcpy(information[j].s_Name, information[j + 1].s_Name);

                strcpy(information[j + 1].s_Name, information_buffer.s_Name);

                strcpy(information_buffer.s_gender, information[j].s_gender);

                strcpy(information[j].s_gender, information[j + 1].s_gender);

                strcpy(information[j + 1].s_gender, information_buffer.s_gender);

                strcpy(information_buffer.s_faculty, information[j].s_faculty);

                strcpy(information[j].s_faculty, information[j + 1].s_faculty);

                strcpy(information[j + 1].s_faculty, information_buffer.s_faculty);

                strcpy(information_buffer.s_speciality, information[j].s_speciality);

                strcpy(information[j].s_speciality, information[j + 1].s_speciality);

                strcpy(information[j + 1].s_speciality, information_buffer.s_speciality);

                strcpy(information_buffer.s_grade, information[j].s_grade);

                strcpy(information[j].s_grade, information[j + 1].s_grade);

                strcpy(information[j + 1].s_grade, information_buffer.s_grade);

                strcpy(information_buffer.s_number, information[j].s_number);

                strcpy(information[j].s_number, information[j + 1].s_number);

                strcpy(information[j + 1].s_number, information_buffer.s_number);

            }

        }

    }

    //输出数据

    for (int a = 0; a < 14; a++)

    {

        //将结构数组中数据输出到表格

        outtextxy(33.25, 118 + a * longitudinal, information[a].s_studentID);//credit[b].studentID

        outtextxy(33.25+ Transverse, 118 + a * longitudinal, information[a].s_Name);

        outtextxy(33.25 + 2 * Transverse, 118 + a * longitudinal, information[a].s_gender);

        outtextxy(33.25 + 3 * Transverse, 118 + a * longitudinal, information[a].s_faculty);

        outtextxy(33.25+ 4 * Transverse, 118+ a * longitudinal, information[a].s_speciality);

        outtextxy(33.25 + 5 * Transverse, 118 + a * longitudinal, information[a].s_grade);

        outtextxy(33.25 + 6 * Transverse, 118 + a * longitudinal, information[a].s_number);

    }

    //按键的响应

    while (1)//时刻获取鼠标信息

    {

        if (MouseHit())//如果有消息

        {

            MOUSEMSG information_s = GetMouseMsg();//设置变量引入消息

            switch (information_s.uMsg)//判断是什么信息

            {

            case WM_LBUTTONDOWN://左键

                //(返回)按钮

                if (information_s.x > 21.24 && information_s.x < 122.44 && information_s.y>663.31 && information_s.y < 706.77)

                {

                    managewindows();//管理员界面

                    break;

                }

                //(显示学分)按钮

                else if (information_s.x > 956.13 && information_s.x < 1085.75 && information_s.y>663.31 && information_s.y < 706.77)

                {

                    credit_homepage();//首页学分表

                    break;

                }

                //(下一页)按钮

                else if (information_s.x > 1122.41 && information_s.x < 1227.47 && information_s.y>633.31 && information_s.y < 706.77)

                {

                    information_secondarypage();//次页学生信息表

                    break;

                }

            }

        }

    }

}

(十)次页学生信息表

void information_secondarypage()//次页学生信息表

{

    IMAGE informationpicture_c;//定义界面图片指针

    loadimage(&informationpicture_c, "E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\界面图片\\次页学生信息表.png", 1280, 720);

    putimage(0, 0, &informationpicture_c);

    settextstyle(25, 0, _T("Consolas"));//设置字体大小

    settextcolor(BLACK);//设置字体颜色为黑色

    setbkmode(TRANSPARENT);//消除字体背景颜色

    int b=0;

    //输出数据

    for (int a = 14; a <28 ; a++)

    {

        //将结构数组中数据输出到表格

        outtextxy(33.26, 90 + b * longitudinal, information[a].s_studentID);

        outtextxy(33.26 + Transverse, 90 + b * longitudinal, information[a].s_Name);

        outtextxy(33.26 + 2 * Transverse, 90 + b * longitudinal, information[a].s_gender);

        outtextxy(33.26 + 3 * Transverse, 90 + b * longitudinal, information[a].s_faculty);

        outtextxy(33.26 + 4 * Transverse, 90 + b* longitudinal, information[a].s_speciality);

        outtextxy(33.26 + 5 * Transverse, 90 + b * longitudinal, information[a].s_grade);

        outtextxy(33.26 + 6 * Transverse, 90 + b * longitudinal, information[a].s_number);

        b++;

    }

    //按键的响应

    while (1)//时刻获取鼠标信息

    {

        if (MouseHit())//如果有消息

        {

            MOUSEMSG information_c = GetMouseMsg();//设置变量引入消息

            switch (information_c.uMsg)//判断是什么信息

            {

            case WM_LBUTTONDOWN://左键

                //(上一页)按钮

                if (information_c.x > 996.94 && information_c.x < 1100.87 && information_c.y>651.21 && information_c.y < 695.07)

                {

                    information_homepage();//首页学生信息表

                    break;

                }

                //(下一页)按钮

                else if (information_c.x > 1117.11 && information_c.x < 1221.42 && information_c.y>651.21 && information_c.y < 695.44)

                {

                    information_secondarypage_final();//尾页学生信息表

                    break;

                }

            }

        }

    }

}

(十一)尾页学生信息表

void information_secondarypage_final()//尾页学生信息表

{

    IMAGE informationpicture_w;//定义界面图片指针

    loadimage(&informationpicture_w, "E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\界面图片\\尾页学生信息表.png", 1280, 720);

    putimage(0, 0, &informationpicture_w);

    settextstyle(25, 0, _T("Consolas"));//设置字体大小

    settextcolor(BLACK);//设置字体颜色为黑色

    setbkmode(TRANSPARENT);//消除字体背景颜色

    int b = 0;

    //输出数据

    for (int a =28; a < 42; a++)

    {

        if (strlen(information[a].s_studentID)==0)

        {

            break;

        }

        //将结构数组中数据输出到表格

        outtextxy(33.26, 90 + b * longitudinal, information[a].s_studentID);

        outtextxy(33.26 + Transverse, 90 + b * longitudinal, information[a].s_Name);

        outtextxy(33.26 + 2 * Transverse, 90 + b * longitudinal, information[a].s_gender);

        outtextxy(33.26 + 3 * Transverse, 90 + b * longitudinal, information[a].s_faculty);

        outtextxy(33.26 + 4 * Transverse, 90 + b * longitudinal, information[a].s_speciality);

        outtextxy(33.26 + 5 * Transverse, 90 + b * longitudinal, information[a].s_grade);

        outtextxy(33.26 + 6 * Transverse, 90 + b * longitudinal, information[a].s_number);

        b++;

    }

    //按键的响应

    while (1)//时刻获取鼠标信息

    {

        if (MouseHit())//如果有消息

        {

            MOUSEMSG information_w = GetMouseMsg();//设置变量引入消息

            switch (information_w.uMsg)//判断是什么信息

            {

            case WM_LBUTTONDOWN://左键

                //(上一页)按钮

                if (information_w.x > 1138.66 && information_w.x < 1246.74 && information_w.y>656.13 && information_w.y < 700.72)

                {

                    information_secondarypage();//次页学生信息表

                    break;

                }

            }

        }

    }

}

(十二)对学生数据进行操作

void summary()//对学生数据进行操作

{

    IMAGE summary_s;//定义界面图片指针

    loadimage(&summary_s, "E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\界面图片\\增删查改主界面.png", 1280, 720);

    putimage(0, 0, &summary_s);

    //按键的响应

    while (1)//时刻获取鼠标信息

    {

        if (MouseHit())//如果有消息

        {

            MOUSEMSG summary_q = GetMouseMsg();//设置变量引入消息

            switch (summary_q.uMsg)//判断是什么信息

            {

            case WM_LBUTTONDOWN://左键

                //(返回)按钮

                if (summary_q.x > 25.70 && summary_q.x < 101.28 && summary_q.y>22.30&& summary_q.y < 67.28)

                {

                    managewindows();//管理员

                    break;

                }

                //(录入学生信息)按钮

                else if(summary_q.x > 758.85 && summary_q.x <985.98&& summary_q.y>232.44 && summary_q.y < 330.24)//420

                {

                    if (strlen(information[41].s_studentID)!=0)

                    {

                        int isok = MessageBox(NULL, "数据库已满,无法存入数据", "数据输入", MB_OKCANCEL);//创建提示窗口

                    }

                    else

                    {

                        increase();//录入学生信息

                        break;

                    }

                }

                //(删除学生信息)按钮

                else if (summary_q.x > 758.85 && summary_q.x < 985.98&& summary_q.y>325.04 && summary_q.y < 420.98)

                {

                    erasure();//删除学生信息

                    break;

                }

                //(查找学生信息)按钮

                else if (summary_q.x > 758.85 && summary_q.x < 985.98 && summary_q.y>417.64 && summary_q.y < 474.72)

                {

                    view();//查找学生信息

                    break;

                }

                //(修改学生信息)按钮

                else if (summary_q.x > 758.85 && summary_q.x < 985.98 && summary_q.y>510.24 && summary_q.y < 568.46)

                {

                    correct();//修改学生信息

                    break;

                }

          

            }

        }

    }

}

(十三)录入学生信息

void increase()

//录入学生信息

{

    IMAGE increase_s;//定义界面图片指针

    loadimage(&increase_s, "E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\界面图片\\录入学生信息.png", 1280, 720);

    putimage(0, 0, &increase_s);

    settextcolor(BLACK);//设置字体颜色为黑色

    setbkmode(TRANSPARENT);//消除字体背景颜色

    settextstyle(30, 0, _T("Consolas"));

    FILE* informationfile_s;//定义存取学生信息文件指针

    FILE* creditfile_s;//定义存取学分信息文件指针

    //打开文档进行分析操作

    informationfile_s = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生信息.txt", "r+");

    creditfile_s = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生学分.txt", "r+");

     UseStudentNumber();//载入学生数目

    //提取学生学分数据

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

    {

        //判断数据是否读完

        if (feof(informationfile_s) == 1)

        {

            break;

        }

        //将文件数据保存在结构数组中

        fscanf(informationfile_s, "%s %s %s %s %s %s %s\n",

            information[i].s_studentID,

            information[i].s_Name,

            information[i].s_gender,

            information[i].s_faculty,

            information[i].s_speciality,

            information[i].s_grade,

            information[i].s_number);

        fscanf(creditfile_s, "%s %s %s %s %s %s %s %s\n",

            credit[i].studentID,

            credit[i].Name,

            credit[i].compulsory,

            credit[i].select,

            credit[i].morality,

            credit[i].innovate,

            credit[i].other,

            credit[i].sum);

    }

    fclose(informationfile_s);//关闭文件

    fclose(creditfile_s);//关闭文件

    int accumulation = 0;

    interdict = 0;

    //按键的响应

    while (1)//时刻获取鼠标信息

    {

        if (MouseHit())//如果有消息

        {

            MOUSEMSG increase_q = GetMouseMsg();//设置变量引入消息

            switch (increase_q.uMsg)//判断是什么信息

            {

            case WM_LBUTTONDOWN://左键

                //(返回)按钮

                if (increase_q.x > 26.45 && increase_q.x < 101.66 && increase_q.y>23.43 && increase_q.y < 60.28)

                {

                    summary();//对学生数据进行操作

                    break;

                }

                //(学号)格

                else if (increase_q.x > 63.87 && increase_q.x < 255.47 && increase_q.y>317.86 && increase_q.y < 359.81)

                {

                    TCHAR InputWindow_studentID[] = _T("请输入该学生的学号");

                    InputBox(information_buffer.s_studentID, 15, InputWindow_studentID);

                    //检测是否重复

                    for (int n = 0; n < nowstudentnums; n++)//找的话是小于,不呢能等于

                    {

                        if (strcmp(information_buffer.s_studentID, information[n].s_studentID) == 0)

                        {

                            HWND hnd = GetHWnd();

                            int isok = MessageBox(hnd, "输入学号重复错误,请重新输入", "错误提示", MB_OKCANCEL);

                            if (isok == IDOK)

                            {  

                                interdict = 1;

                                break;

                            }

                            else if (IDCANCEL == isok)

                            {

                                interdict = 1;

                                break;

                            }

                        }

                    }

                    if (interdict == 1)

                    {

                        continue;

                    }

                    //检测完成——进行屏幕输出

                    outtextxy(63.87, 322.86, information_buffer.s_studentID);

                    //保存在结构数组中

                    strcpy(information[nowstudentnums].s_studentID, information_buffer.s_studentID);

                    strcpy(credit[nowstudentnums].studentID, information_buffer.s_studentID);

                    accumulation += 1;

                }

                //(姓名)格

                else if (increase_q.x > 255.47 && increase_q.x < 379.43 && increase_q.y>317.86 && increase_q.y < 359.81)

                {

                    TCHAR InputWindow_Name[] = _T("请输入该学生的姓名");

                    InputBox(information_buffer.s_Name, 15, InputWindow_Name);

                    //进行输出

                    outtextxy(255.47, 322.86, information_buffer.s_Name);

                    //保存在结构数组中

                    strcpy(information[nowstudentnums].s_Name, information_buffer.s_Name);

                    strcpy(credit[nowstudentnums].Name, information_buffer.s_Name);

                    accumulation += 1;

                }

                //(性别)格

                else if (increase_q.x > 379.43 && increase_q.x < 452.36 && increase_q.y>317.86 && increase_q.y < 359.81)

                {

                    TCHAR InputWindow_gender[] = _T("请输入该学生的性别");

                    InputBox(information_buffer.s_gender, 15, InputWindow_gender);

                    //进行输出

                    outtextxy(379.43, 322.86, information_buffer.s_gender);

                    //保存在结构数组中

                    strcpy(information[nowstudentnums].s_gender, information_buffer.s_gender);

                    accumulation += 1;

                }

                //(院系)格

                else if (increase_q.x > 452.36 && increase_q.x < 691.59 && increase_q.y>317.86 && increase_q.y < 359.81)

                {

                    TCHAR InputWindow_faculty[] = _T("请输入该学生的院系全称");

                    InputBox(information_buffer.s_faculty, 15, InputWindow_faculty);

                    //进行输出

                    outtextxy(452.36, 322.86, information_buffer.s_faculty);

                    //保存在结构数组中

                    strcpy(information[nowstudentnums].s_faculty, information_buffer.s_faculty);

                    accumulation += 1;

                }

                //(专业)格

                else if (increase_q.x > 691.59 && increase_q.x < 865.43 && increase_q.y>317.86 && increase_q.y < 359.81)

                {

                    TCHAR InputWindow_speciality[] = _T("请输入该学生的专业");

                    InputBox(information_buffer.s_speciality, 15, InputWindow_speciality);

                    //进行输出

                    outtextxy(691.59, 322.86, information_buffer.s_speciality);

                    //保存在结构数组中

                    strcpy(information[nowstudentnums].s_speciality, information_buffer.s_speciality);

                    accumulation += 1;

                }

                //(年级)格

                else if (increase_q.x > 865.43 && increase_q.x < 987.12 && increase_q.y>317.86 && increase_q.y < 359.81)

                {

                    TCHAR InputWindow_grade[] = _T("请输入该学生的年级,例(2201)22届1班");

                    InputBox(information_buffer.s_grade, 15, InputWindow_grade);

                    //进行输出

                    outtextxy(865.43, 322.86, information_buffer.s_grade);

                    //保存在结构数组中

                    strcpy(information[nowstudentnums].s_grade, information_buffer.s_grade);

                    accumulation += 1;

                }

                //(手机号)格

                else if (increase_q.x > 987.12 && increase_q.x < 1216.51 && increase_q.y>317.86 && increase_q.y < 359.81)

                {

                    TCHAR InputWindow_number[] = _T("请输入该学生的手机号");

                    InputBox(information_buffer.s_number, 15, InputWindow_number);

                    // 进行输出

                    outtextxy(987.12, 322.86, information_buffer.s_number);

                    //保存在结构数组中

                    strcpy(information[nowstudentnums].s_number, information_buffer.s_number);

                    accumulation += 1;

                }

                //(必修)格

                else if (increase_q.x > 63 && increase_q.x <144 && increase_q.y>459.21 && increase_q.y < 500)

                {

                    TCHAR InputWimdow_compulsory[] = _T("请输入该学生的必修");

                    InputBox(credit_buffer.compulsory, 15, InputWimdow_compulsory);

                    // 进行输出

                    outtextxy(63.87, 464.21, credit_buffer.compulsory);

                    //保存在结构数组中

                    strcpy(credit[nowstudentnums].compulsory, credit_buffer.compulsory);

                    accumulation += 1;

                }

                //(选修)格

                else if (increase_q.x > 144.74 && increase_q.x < 225.61 && increase_q.y>459.21 && increase_q.y < 500.03)

                {

                    TCHAR InputWimdow_select[] = _T("请输入该学生的选修");

                    InputBox(credit_buffer.select, 15, InputWimdow_select);

                    // 进行输出

                    outtextxy(145, 464, credit_buffer.select);

                    //保存在结构数组中

                    strcpy(credit[nowstudentnums].select, credit_buffer.select);

                    accumulation += 1;

                }

                //(德育)格

                else if (increase_q.x > 225.61 && increase_q.x < 306.48 && increase_q.y>459.21 && increase_q.y < 500.03)

                {

                    TCHAR InputWimdow_morality[] = _T("请输入该学生的德育");

                    InputBox(credit_buffer.morality, 15, InputWimdow_morality);

                    // 进行输出

                    outtextxy(226, 464, credit_buffer.morality);

                    //保存在结构数组中

                    strcpy(credit[nowstudentnums].morality, credit_buffer.morality);

                    accumulation += 1;

                }

                //(选修)格

                else if (increase_q.x > 27 && increase_q.x < 102 && increase_q.y>592 && increase_q.y < 632)

                {

                    TCHAR InputWimdow_select[] = _T("请输入该学生的选修");

                    InputBox(credit_buffer.select, 15, InputWimdow_select);

                    // 进行输出

                    outtextxy(307, 464, credit_buffer.select);

                    //保存在结构数组中

                    strcpy(credit[nowstudentnums].select, credit_buffer.select);

                    accumulation += 1;

                }

                //(创新)格

                else if (increase_q.x > 306.48 && increase_q.x < 387.35 && increase_q.y>459.21 && increase_q.y < 500.03)

                {

                    TCHAR InputWimdow_innovate[] = _T("请输入该学生的创新");

                    InputBox(credit_buffer.innovate, 15, InputWimdow_innovate);

                    // 进行输出

                    outtextxy(307, 464, credit_buffer.innovate);

                    //保存在结构数组中

                    strcpy(credit[nowstudentnums].innovate, credit_buffer.innovate);

                    accumulation += 1;

                }

                //(其它)格

                else if (increase_q.x > 387.35 && increase_q.x < 468.22 && increase_q.y>459.21 && increase_q.y < 500.03)

                {

                    TCHAR InputWimdow_other[] = _T("请输入该学生的其它学分");

                    InputBox(credit_buffer.other, 15, InputWimdow_other);

                    // 进行输出

                    outtextxy(388, 464, credit_buffer.other);

                    //保存在结构数组中

                    strcpy(credit[nowstudentnums].other, credit_buffer.other);

                    accumulation += 1;

                }

                //(总分)格

                else if (increase_q.x > 468.22 && increase_q.x < 549.09 && increase_q.y>459.21 && increase_q.y < 500.03)

                {

                    //计算总分

                    int sum_s = atof(credit[nowstudentnums].compulsory) + atof(credit[nowstudentnums].select) + atof(credit[nowstudentnums].morality) + atof(credit[nowstudentnums].innovate) + atof(credit[nowstudentnums].other);

                    //赋予数组

                    sprintf(credit[nowstudentnums].sum, "%d", sum_s);

                    //进行输出

                    outtextxy(469, 464, credit[nowstudentnums].sum);

                    accumulation += 1;

                }

                //(确定)按钮

                else if (increase_q.x > 853.33 && increase_q.x < 974.06 && increase_q.y>588.47 && increase_q.y < 642.14)

                {

                    //如果有一个没输入完,就不能保存

                    if (accumulation !=13)

                    {

                        HWND hnd = GetHWnd();

                        int isok = MessageBox(hnd, "数据没有录完,请继续录入", "错误提示", MB_OKCANCEL);

                        if (isok == IDOK)

                        {

                            interdict = 1;

                            continue;

                        }

                        else if (IDCANCEL == isok)

                        {

                            interdict = 1;

                            continue;

                        }

                    }

                    else

                    {

                        FILE* increase_g;//定义输入信息文件指针

                        FILE* increase_l;//定义存取信息文件指针

                        //打开文档进行分析操作

                        increase_g = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生信息.txt", "w+");

                        increase_l = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生学分.txt", "w+");

                            UseStudentNumber();//载入学生人数

                        int y;//循环变量

                        //存入学生数据

                        for (y = 0; y <= nowstudentnums ; y++)//42

                        {

                            //判断数据是否存完

                            if (strlen(information[y].s_studentID) == 0)

                            {

                                break;

                            }

                            //将结构数据保存在文件中

                            fprintf(increase_g, "%s %s %s %s %s %s %s\n",

                                information[y].s_studentID,

                                information[y].s_Name,

                                information[y].s_gender,

                                information[y].s_faculty,

                                information[y].s_speciality,

                                information[y].s_grade,

                                information[y].s_number);

                            fprintf(increase_l, "%s %s %s %s %s %s %s %s\n",

                                credit[y].studentID,

                                credit[y].Name,

                                credit[y].compulsory,

                                credit[y].select,

                                credit[y].morality,

                                credit[y].innovate,

                                credit[y].other,

                                credit[y].sum);

                        }

                        fclose(increase_g);//关闭文件

                        fclose(increase_l);//关闭文件

                        nowstudentnums = nowstudentnums + 1;

                            SaveStudentNumber();//记录学生人数

                        HWND hnd = GetHWnd();

                        int isok = MessageBox(hnd, "录入成功!", "成功提示", MB_OKCANCEL);

                        if (isok == IDOK)

                        {

                            interdict = 1;

                            continue;

                        }

                        else if (IDCANCEL == isok)

                        {

                            interdict = 1;

                            continue;

                        }

                    }

                }

                //(再填下一个)按钮

                else if (increase_q.x > 975.78 && increase_q.x < 1163.60 && increase_q.y>588.47 && increase_q.y < 642.14)

                {

                    increase();//录入学生信息

                       UseStudentNumber();//载入学生数目

                }

            }

        }

    }

}

(十四)删除学生信息

void erasure()//删除学生信息

{

    IMAGE erasure_s;//定义界面图片指针

    loadimage(&erasure_s, "E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\界面图片\\删除学生信息.png", 1280, 720);

    putimage(0, 0, &erasure_s);

    settextcolor(BLACK);//设置字体颜色为黑色

    setbkmode(TRANSPARENT);//消除字体背景颜色

     UseStudentNumber();//载入学生数目

    FILE* informationfile_s;//定义存取学生信息文件指针

    FILE* creditfile_s;//定义存取学分信息文件指针

    //打开文档进行分析操作

    informationfile_s = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生信息.txt", "r");

    creditfile_s = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生学分.txt", "r");

    //提取学生学分数据

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

    {

        //判断数据是否读完

        if (feof(informationfile_s) == 1)

        {

            break;

        }

        //将文件数据保存在结构数组中

        fscanf(informationfile_s, "%s %s %s %s %s %s %s\n",

            information[i].s_studentID,

            information[i].s_Name,

            information[i].s_gender,

            information[i].s_faculty,

            information[i].s_speciality,

            information[i].s_grade,

            information[i].s_number);

        fscanf(creditfile_s, "%s %s %s %s %s %s %s %s\n",

            credit[i].studentID,

            credit[i].Name,

            credit[i].compulsory,

            credit[i].select,

            credit[i].morality,

            credit[i].innovate,

            credit[i].other,

            credit[i].sum);

    }

    fclose(informationfile_s);//关闭文件

    fclose(creditfile_s);//关闭文件

    int u = 0,k=0;

    //获取鼠标操作

    while (1)//时刻获取鼠标信息

    {

        if (MouseHit())//如果有消息

        {

            MOUSEMSG erasure_b = GetMouseMsg();//设置变量引入消息

            switch (erasure_b.uMsg)//判断是什么信息

            {

            case WM_LBUTTONDOWN://左键

                //返回按钮

                if (erasure_b.x >26.45 && erasure_b.x < 101.66&& erasure_b.y>23.43 && erasure_b.y < 67.28)

                {

                    summary();//对学生数据进行操作

                    break;

                }

                //学号按钮

                else if (erasure_b.x > 410 && erasure_b.x < 810 && erasure_b.y>270 && erasure_b.y < 370)

                {

                    TCHAR InputWindow_studentID[] = _T("请输入要删除学生的学号");

                    InputBox(information_buffer.s_studentID, 15, InputWindow_studentID);

                    //定位该生所在位置

                    for (u ; u < 42; u++)

                    {

                        if (strcmp(information_buffer.s_studentID, information[u].s_studentID) == 0)

                        {

                            break;

                        }

                    }

                    for (k; k < 42; k++)

                    {

                        if (strcmp(information_buffer.s_studentID, credit[k].studentID) == 0)

                        {

                            break;

                        }

                    }

                    if (u == 42)

                    {

                        HWND mmm = GetHWnd();

                        int i = MessageBox(mmm, "没有该学生,无法进行删除", "错误提示", MB_OKCANCEL);

                        if (i == IDOK)

                        {

                            continue;

                        }

                        else if (IDCANCEL == i)

                        {

                            continue;

                        }

                    }

                    //在指定的图框中显示

                    outtextxy(450, 270.24, information[u].s_studentID);

                    settextstyle(25, 0, _T("Consolas"));

                    outtextxy(170.06, 444.47, information[u].s_Name);

                    outtextxy(297.42, 444.47, information[u].s_gender);

                    outtextxy(369.98, 444.47, information[u].s_faculty);

                    outtextxy(608.44, 444.47, information[u].s_speciality);

                    outtextxy(781.15, 444.47, information[u].s_grade);

                    outtextxy(903.97, 444.47, information[u].s_number);

                }

                //确定按钮

                else if (erasure_b.x > 853.71 && erasure_b.x < 947.43 && erasure_b.y>588.09 && erasure_b.y < 643.65)

                {

                    //char a[15] = "555555555555";

                    //strcpy(information[u].s_studentID, a);

                    FILE* erasure_g;//定义输入信息文件指针

                    FILE* erasure_l;//定义存取信息文件指针

                    //打开文档进行分析操作

                    erasure_g = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生信息.txt", "w+");

                    erasure_l = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生学分.txt", "w+");

                       UseStudentNumber();//载入学生数据

                       nowstudentnums = nowstudentnums - 1;//删除后学生人数减1

                    int y;//循环变量

                    //存入学生数据

                       for (y = 0; y <= nowstudentnums; y++)

                    {

                        if (y == u)

                        {

                            continue;

                        }

                        //将结构数据保存在文件中

                        fprintf(erasure_g, "%s %s %s %s %s %s %s\n",

                            information[y].s_studentID,

                            information[y].s_Name,

                            information[y].s_gender,

                            information[y].s_faculty,

                            information[y].s_speciality,

                            information[y].s_grade,

                            information[y].s_number);

                    }

                       for (y = 0; y < nowstudentnums; y++)//for (y = 0; y < 42; y++)

                    {

                        if (y == k)

                        {

                            continue;

                        }

                        fprintf(erasure_l, "%s %s %s %s %s %s %s %s\n",

                            credit[y].studentID,

                            credit[y].Name,

                            credit[y].compulsory,

                            credit[y].select,

                            credit[y].morality,

                            credit[y].innovate,

                            credit[y].other,

                            credit[y].sum);

                    }

                    fclose(erasure_g);//关闭文件

                    fclose(erasure_l);//关闭文件

                       //nowstudentnums = nowstudentnums - 1;//删除后学生人数减1

                       SaveStudentNumber();//记录当前学生人数

                    //打开文档进行分析操作

                    erasure_g = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生信息.txt", "r+");

                    erasure_l = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生学分.txt", "r+");

                    int o;//学生信息数据个数

                    //提取学生学分数据

                    for (o = 0; o < 42; o++)

                    {

                        //判断数据是否读完

                        if (feof(erasure_g) == 1)

                        {

                            break;

                        }

                        //将文件数据保存在结构数组中

                        fscanf(erasure_g, "%s %s %s %s %s %s %s\n",

                            information[o].s_studentID,

                            information[o].s_Name,

                            information[o].s_gender,

                            information[o].s_faculty,

                            information[o].s_speciality,

                            information[o].s_grade,

                            information[o].s_number);

                        fscanf(erasure_l, "%s %s %s %s %s %s %s %s\n",

                            credit[o].studentID,

                            credit[o].Name,

                            credit[o].compulsory,

                            credit[o].select,

                            credit[o].morality,

                            credit[o].innovate,

                            credit[o].other,

                            credit[o].sum);

                    }

                    fclose(erasure_g);//关闭文件

                    fclose(erasure_l);//关闭文件

                    HWND mmm = GetHWnd();

                    int i = MessageBox(mmm, "删除成功", "成功提示", MB_OKCANCEL);

                    if (i == IDOK)

                    {

                        interdict = 1;

                        continue;

                    }

                    else if (IDCANCEL == i)

                    {

                        interdict = 1;

                        continue;

                    }

                }

               //再删下一个按钮

                else if (erasure_b.x > 975.78 && erasure_b.x < 1165.50 && erasure_b.y>588.09 && erasure_b.y < 643.65)

                {

                    erasure();//删除学生信息

                       UseStudentNumber();//载入学生数目

                    break;

                } 

            }

        }

    }

}

(十五)查找学生信息

void view()//查找学生信息

{

   

    IMAGE view_s;//定义界面图片指针

    loadimage(&view_s, "E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\界面图片\\查询学生信息.png", 1280, 720);

    putimage(0, 0, &view_s);

    settextcolor(BLACK);//设置字体颜色为黑色

    setbkmode(TRANSPARENT);//消除字体背景颜色

     UseStudentNumber();//载入学生数目

    FILE* informationfile_s;//定义存取学生信息文件指针

    FILE* creditfile_s;//定义存取学分信息文件指针

    //打开文档进行分析操作

    informationfile_s = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生信息.txt", "r+");

    creditfile_s = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生学分.txt", "r+");

    //提取学生学分数据

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

    {

        //判断数据是否读完

        if (feof(informationfile_s) == 1)

        {

            break;

        }

        //将文件数据保存在结构数组中

        fscanf(informationfile_s, "%s %s %s %s %s %s %s\n",

            information[i].s_studentID,

            information[i].s_Name,

            information[i].s_gender,

            information[i].s_faculty,

            information[i].s_speciality,

            information[i].s_grade,

            information[i].s_number);

        fscanf(creditfile_s, "%s %s %s %s %s %s %s %s\n",

            credit[i].studentID,

            credit[i].Name,

            credit[i].compulsory,

            credit[i].select,

            credit[i].morality,

            credit[i].innovate,

            credit[i].other,

            credit[i].sum);

    }

    fclose(informationfile_s);//关闭文件

    fclose(creditfile_s);//关闭文件

    int u = 0;

    //获取鼠标操作

    while (1)//时刻获取鼠标信息

    {

        if (MouseHit())//如果有消息

        {

            MOUSEMSG view_b = GetMouseMsg();//设置变量引入消息

            switch (view_b.uMsg)//判断是什么信息

            {

            case WM_LBUTTONDOWN://左键

                //返回按钮

                if (view_b.x > 24.94 && view_b.x < 101.66 && view_b.y>22.68 && view_b.y <67.28)

                {

                    summary();//对学生数据进行操作

                    break;

                }

                //显示学号按钮

                else if (view_b.x > 500 && view_b.x < 800 && view_b.y>250 && view_b.y < 300)

                {

                    TCHAR InputWindow_studentID[] = _T("请输入要查找学生的学号,点击确认键查找");

                    InputBox(information_buffer.s_studentID, 15, InputWindow_studentID);

                    settextstyle(40, 0, _T("Consolas"));

                    //定位该生所在位置

                    for (u ; u < 42; u++)

                    {

                        if (strcmp(information_buffer.s_studentID, information[u].s_studentID) == 0)

                        {

                            break;

                        }

                    }

                    if (u == 42)

                    {

                        HWND hnd = GetHWnd();

                        int isok = MessageBox(hnd, "该学生不存在", "错误提示", MB_OKCANCEL);

                        if (isok == IDOK)

                        {

                            continue;

                        }

                        else if (IDCANCEL == isok)

                        {

                            continue;

                        }

                    }

                    else

                    {

                        outtextxy(500, 250, information[u].s_studentID);

                    }

                }

                //确定按钮

                else if (view_b.x > 853.71 && view_b.x < 946.68 && view_b.y>588.09 && view_b.y < 642.53)

                {

                    if (strlen(information_buffer.s_studentID) == 0)

                    {

                        HWND hnd = GetHWnd();

                        int isok = MessageBox(hnd, "你还没有输入学号哦,请输入", "错误提示", MB_OKCANCEL);

                        if (isok == IDOK)

                        {

                            continue;

                        }

                        else if (IDCANCEL == isok)

                        {

                            continue;

                        }

                    }

                    else

                    {

                        settextstyle(25, 0, _T("Consolas"));

                        outtextxy(143.61, 400, information[u].s_Name);

                        outtextxy(270.94, 400, information[u].s_gender);

                        outtextxy(342.39, 400, information[u].s_faculty);

                        outtextxy(580.86, 400, information[u].s_speciality);

                        outtextxy(753.94, 400, information[u].s_grade);

                        outtextxy(875.63, 400, information[u].s_number);

                        outtextxy(368.47, 540, credit[u].compulsory);

                        outtextxy(450.85, 540, credit[u].select);

                        outtextxy(533.23, 540, credit[u].morality);

                        outtextxy(615.61, 540, credit[u].innovate);

                        outtextxy(697.99, 540, credit[u].other);

                        outtextxy(780.37, 540, credit[u].sum);

                    }

                }

                //再查下一个按钮

                else if (view_b.x > 976.16 && view_b.x < 1163.98 && view_b.y>588.09 && view_b.y < 642.53)

                {

                    view();//查找学生信息

                    break;

                }

           

            }

        }

    }

}

(十六)修改学生信息

void correct()//修改学生信息

{

    IMAGE correct_s;//定义界面图片指针

    loadimage(&correct_s, "E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\界面图片\\修改学生信息.png", 1280, 720);

    putimage(0, 0, &correct_s);

    settextcolor(BLACK);//设置字体颜色为黑色

    setbkmode(TRANSPARENT);//消除字体背景颜色

    settextstyle(25, 0, _T("Consolas"));

     UseStudentNumber();//载入学生数目

    FILE* informationfile_s;//定义存取学生信息文件指针

    FILE* creditfile_s;//定义存取学分信息文件指针

    //打开文档进行分析操作

    informationfile_s = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生信息.txt", "r+");

    creditfile_s = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生学分.txt", "r+");

    //提取学生学分数据

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

    {

        //判断数据是否读完

        if (feof(informationfile_s) == 1)

        {

            break;

        }

        //将文件数据保存在结构数组中

        fscanf(informationfile_s, "%s %s %s %s %s %s %s\n",

            information[i].s_studentID,

            information[i].s_Name,

            information[i].s_gender,

            information[i].s_faculty,

            information[i].s_speciality,

            information[i].s_grade,

            information[i].s_number);

        fscanf(creditfile_s, "%s %s %s %s %s %s %s %s\n",

            credit[i].studentID,

            credit[i].Name,

            credit[i].compulsory,

            credit[i].select,

            credit[i].morality,

            credit[i].innovate,

            credit[i].other,

            credit[i].sum);

    }

    fclose(informationfile_s);//关闭文件

    fclose(creditfile_s);//关闭文件

    int u = 0;

    //按键的响应

    while (1)//时刻获取鼠标信息

    {

        if (MouseHit())//如果有消息

        {

            MOUSEMSG correct_q = GetMouseMsg();//设置变量引入消息

            switch (correct_q.uMsg)//判断是什么信息

            {

            case WM_LBUTTONDOWN://左键

                //(返回)按钮

                if (correct_q.x >16.63 && correct_q.x < 93.72 && correct_q.y>17.01 && correct_q.y < 60.85)

                {

                    summary();//对学生数据进行操作

                    break;

                }

                //(输入学号按钮)

                else if (correct_q.x > 530 && correct_q.x < 830 && correct_q.y>187 && correct_q.y < 237)

                {

                    char a[15];

                    TCHAR InputWindow_studentID[] = _T("请输入要修改学生的学号");

                    InputBox(a, 15, InputWindow_studentID);

                   

                    //定位该生所在位置

                    for (u; u < 42; u++)

                    {

                        if (strcmp(a, information[u].s_studentID) == 0)

                        {

                            break;

                        }

                    }

                    if (u == 42)

                    {

                        HWND hnd = GetHWnd();

                        int isok = MessageBox(hnd, "该学生不存在", "错误提示", MB_OKCANCEL);

                        if (isok == IDOK)

                        {

                            continue;

                        }

                        else if (IDCANCEL == isok)

                        {

                            continue;

                        }

                    }

                    else

                    {

                        outtextxy(530.74, 187.53, information[u].s_studentID);

                        outtextxy(100, 321.26, information[u].s_Name);

                        outtextxy(100, 359.81, information[u].s_gender);

                        outtextxy(100, 398, information[u].s_faculty);

                        outtextxy(100, 436, information[u].s_speciality);

                        outtextxy(100, 475, information[u].s_grade);

                        outtextxy(120, 515, information[u].s_number);

                        outtextxy(354, 321.26, credit[u].compulsory);

                        outtextxy(354, 359.81, credit[u].select);

                        outtextxy(354, 398, credit[u].morality);

                        outtextxy(354, 436, credit[u].innovate);

                        outtextxy(354, 475, credit[u].other);

                        outtextxy(354, 515, credit[u].sum);

                    }

                }

               

                //(姓名)格

                else if (correct_q.x > 789 && correct_q.x < 971&& correct_q.y>321 && correct_q.y < 359)

                {

                    TCHAR InputWindow_Name[] = _T("请输入该学生的姓名");

                    InputBox(information_buffer.s_Name, 15, InputWindow_Name);

                    //进行输出

                    outtextxy(789, 321, information_buffer.s_Name);

                    //保存在结构数组中

                    strcpy(information[u].s_Name, information_buffer.s_Name);

                    strcpy(credit[u].Name, information_buffer.s_Name);

                }

                //(性别)格

                else if (correct_q.x > 789 && correct_q.x < 971 && correct_q.y>359 && correct_q.y < 397)

                {

                    TCHAR InputWindow_gender[] = _T("请输入该学生的性别");

                    InputBox(information_buffer.s_gender, 15, InputWindow_gender);

                    //进行输出

                    outtextxy(789, 359, information_buffer.s_gender);

                    //保存在结构数组中

                    strcpy(information[u].s_gender, information_buffer.s_gender);

                }

                //(院系)格

                else if (correct_q.x > 789 && correct_q.x < 971 && correct_q.y>397 && correct_q.y < 435)

                {

                    TCHAR InputWindow_faculty[] = _T("请输入该学生的院系全称");

                    InputBox(information_buffer.s_faculty, 15, InputWindow_faculty);

                    //进行输出

                    outtextxy(789, 398, information_buffer.s_faculty);

                    //保存在结构数组中

                    strcpy(information[u].s_faculty, information_buffer.s_faculty);

                }

                //(专业)格

                else if (correct_q.x > 789 && correct_q.x < 971 && correct_q.y>435 && correct_q.y < 473)

                {

                    TCHAR InputWindow_speciality[] = _T("请输入该学生的专业");

                    InputBox(information_buffer.s_speciality, 15, InputWindow_speciality);

                    //进行输出

                    outtextxy(789, 436, information_buffer.s_speciality);

                    //保存在结构数组中

                    strcpy(information[u].s_speciality, information_buffer.s_speciality);

                }

                //(年级)格

                else if (correct_q.x > 789 && correct_q.x < 971 && correct_q.y>473 && correct_q.y < 511)

                {

                    TCHAR InputWindow_grade[] = _T("请输入该学生的年级,例(2201)22届1班");

                    InputBox(information_buffer.s_grade, 15, InputWindow_grade);

                    //进行输出

                    outtextxy(789, 475, information_buffer.s_grade);

                    //保存在结构数组中

                    strcpy(information[u].s_grade, information_buffer.s_grade);

                }

                //(手机号)格

                else if (correct_q.x > 822 && correct_q.x < 971 && correct_q.y>511 && correct_q.y < 549)

                {

                    TCHAR InputWindow_number[] = _T("请输入该学生的手机号");

                    InputBox(information_buffer.s_number, 15, InputWindow_number);

                    // 进行输出

                    outtextxy(822, 515.53, information_buffer.s_number);

                    //保存在结构数组中

                    strcpy(information[u].s_number, information_buffer.s_number);

                }

                //(必修)格

                else if (correct_q.x > 971 && correct_q.x < 1153 && correct_q.y>321 && correct_q.y < 359)

                {

                    TCHAR InputWimdow_compulsory[] = _T("请输入该学生的必修");

                    InputBox(credit_buffer.compulsory, 15, InputWimdow_compulsory);

                    // 进行输出

                    outtextxy(1043, 321, credit_buffer.compulsory);

                    //保存在结构数组中

                    strcpy(credit[u].compulsory, credit_buffer.compulsory);

                }

                //(选修)格

                else if (correct_q.x > 1043 && correct_q.x < 1225 && correct_q.y>359 && correct_q.y < 397)

                {

                    TCHAR InputWimdow_select[] = _T("请输入该学生的选修");

                    InputBox(credit_buffer.select, 15, InputWimdow_select);

                    // 进行输出

                    outtextxy(1043, 359, credit_buffer.select);

                    //保存在结构数组中

                    strcpy(credit[u].select, credit_buffer.select);

                }

                //(德育)格

                else if (correct_q.x > 1043 && correct_q.x < 1225 && correct_q.y>397 && correct_q.y < 435)

                {

                    TCHAR InputWimdow_morality[] = _T("请输入该学生的德育");

                    InputBox(credit_buffer.morality, 15, InputWimdow_morality);

                    // 进行输出

                    outtextxy(1043, 398, credit_buffer.morality);

                    //保存在结构数组中

                    strcpy(credit[u].morality, credit_buffer.morality);

                }

                //(创新)格

                else if (correct_q.x > 1043 && correct_q.x < 1225 && correct_q.y>435 && correct_q.y < 473)

                {

                    TCHAR InputWimdow_innovate[] = _T("请输入该学生的创新");

                    InputBox(credit_buffer.innovate, 15, InputWimdow_innovate);

                    // 进行输出

                    outtextxy(1043, 436, credit_buffer.innovate);

                    //保存在结构数组中

                    strcpy(credit[u].innovate, credit_buffer.innovate);

                }

                //(其它)格

                else if (correct_q.x > 1043 && correct_q.x < 1225 && correct_q.y>473 && correct_q.y < 511)

                {

                    TCHAR InputWimdow_other[] = _T("请输入该学生的其它学分");

                    InputBox(credit_buffer.other, 15, InputWimdow_other);

                    // 进行输出

                    outtextxy(1043, 475, credit_buffer.other);

                    //保存在结构数组中

                    strcpy(credit[u].other, credit_buffer.other);

                }

                //(总分)格

                else if (correct_q.x > 1043 && correct_q.x < 1225 && correct_q.y>511 && correct_q.y < 549)

                {

                    //计算总分

                    int sum_s = atof(credit[u].compulsory) + atof(credit[u].select) + atof(credit[u].morality) + atof(credit[u].innovate) + atof(credit[u].other);

                    //赋予数组

                    sprintf(credit[u].sum, "%d", sum_s);

                    //进行输出

                    outtextxy(1043, 515, credit[u].sum);

                }

                //(确定)按钮

                else if (correct_q.x > 852 && correct_q.x < 979 && correct_q.y>638 && correct_q.y < 684)

                {

                    FILE* correct_g;//定义输入信息文件指针

                    FILE* correct_l;//定义存取信息文件指针

                    //打开文档进行分析操作

                    correct_g = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生信息.txt", "w+");

                    correct_l = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生学分.txt", "w+");

                        UseStudentNumber();//载入学生数目

                    int y;//循环变量

                    //存入学生数据

                       for (y = 0; y <= nowstudentnums; y++)//42

                    {

                        //判断数据是否存完

                        if (strlen(information[y].s_studentID) == 0 && y == 42)

                        {

                            break;

                        }

                        //将结构数据保存在文件中

                        fprintf(correct_g, "%s %s %s %s %s %s %s\n",

                            information[y].s_studentID,

                            information[y].s_Name,

                            information[y].s_gender,

                            information[y].s_faculty,

                            information[y].s_speciality,

                            information[y].s_grade,

                            information[y].s_number);

                        fprintf(correct_l, "%s %s %s %s %s %s %s %s\n",

                            credit[y].studentID,

                            credit[y].Name,

                            credit[y].compulsory,

                            credit[y].select,

                            credit[y].morality,

                            credit[y].innovate,

                            credit[y].other,

                            credit[y].sum);

                    }

                    fclose(correct_g);//关闭文件

                    fclose(correct_l);//关闭文件

                    HWND hnd = GetHWnd();

                    int isok = MessageBox(hnd, "修改成功!", "成功提示", MB_OKCANCEL);

                    if (isok == IDOK)

                    {

                        interdict = 1;

                        continue;

                    }

                    else if (IDCANCEL == isok)

                    {

                        interdict = 1;

                        continue;

                    }

                }

                //(再填下一个)按钮

                else if (correct_q.x > 1013 && correct_q.x < 1190 && correct_q.y>638 && correct_q.y < 684)

                {

                    correct();//修改学生信息

                        UseStudentNumber();//载入学生数目

                }

            }

        }

    }

}

(十七)学生窗口

void studentwindows()//学生窗口

{

    IMAGE correct_s;//定义界面图片指针

    loadimage(&correct_s, "E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\界面图片\\学生主页.png", 1280, 720);

    putimage(0, 0, &correct_s);

    //按键的响应

    while (1)//时刻获取鼠标信息

    {

        if (MouseHit())//如果有消息

        {

            MOUSEMSG credit_c = GetMouseMsg();//设置变量引入消息

            switch (credit_c.uMsg)//判断是什么信息

            {

            case WM_LBUTTONDOWN://左键

                //(返回)按钮

                if (credit_c.x > 15.48 && credit_c.x < 92.97 && credit_c.y>14 && credit_c.y < 58)

                {

                    main();//主窗口

                    break;

                }

                //(我要登录)按钮

                else if (credit_c.x > 806.09 && credit_c.x < 981.07 && credit_c.y>323.15 && credit_c.y < 383.62)

                {

                       UseStudentNumber();//载入学生数目

                    student_login();

                    break;

                }

                //(我要注册)按钮

                else if (credit_c.x > 806.09 && credit_c.x < 981.07 && credit_c.y>464.88 && credit_c.y < 525.35)

                {

                       UseStudentNumber();//载入学生数目

                    student_registration();//学生注册

                    break;

                }

            }

        }

    }

}

(十八)载入学生数目

void UseStudentNumber()

{

     FILE *fp = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生数据.txt","r+");

     fscanf(fp,"%d",&nowstudentnums);

     fclose(fp);

}

(十九)存储学生数目

void SaveStudentNumber()

{

     FILE *fp = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生数据.txt","w");

     fprintf(fp,"%d",nowstudentnums);

     fclose(fp);

}

(二十)学生注册

void student_registration()//学生注册

{

    IMAGE correct_s;//定义界面图片指针

    loadimage(&correct_s, "E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\界面图片\\学生注册界面.png", 1280, 720);

    putimage(0, 0, &correct_s);

    settextcolor(BLACK);//设置字体颜色为黑色

    setbkmode(TRANSPARENT);//消除字体背景颜色

    settextstyle(25, 0, _T("Consolas"));

     UseStudentNumber();//载入学生数目

    FILE* informationfile_s;//定义存取学生信息文件指针

    FILE* creditfile_s;//定义存取学分信息文件指针

    //打开文档进行分析操作

    informationfile_s = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生信息.txt", "r+");

    creditfile_s = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生学分.txt", "r+");

    //提取学生学分数据

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

    {

        //判断数据是否读完

        if (feof(informationfile_s) == 1)

        {

            break;

        }

        //将文件数据保存在结构数组中

        fscanf(informationfile_s, "%s %s %s %s %s %s %s",

            information[i].s_studentID,

            information[i].s_Name,

            information[i].s_gender,

            information[i].s_faculty,

            information[i].s_speciality,

            information[i].s_grade,

            information[i].s_number);

        fscanf(creditfile_s, "%s %s %s %s %s %s %s %s",

            credit[i].studentID,

            credit[i].Name,

            credit[i].compulsory,

            credit[i].select,

            credit[i].morality,

            credit[i].innovate,

            credit[i].other,

            credit[i].sum);

    }

    fclose(informationfile_s);//关闭文件

    fclose(creditfile_s);//关闭文件

     //nowstudentnums = 0;//初始化为0

    TCHAR InputWindow_studentID[] = _T("请输入你的学号");

    InputBox(information_buffer.s_studentID, 15, InputWindow_studentID);

    for (int n = 0; n < nowstudentnums; n++)//找没有等于

    {

        if (strcmp(information_buffer.s_studentID, information[n].s_studentID) == 0 )

        {

            HWND h = GetHWnd();

            int i = MessageBox(h, "此用户已注册", "错误提示", MB_OKCANCEL);

            if (i == IDOK)

            {

                student_registration();

            }

            else if (IDCANCEL == i)

            {

                studentwindows();

            }

        }

    }

    //保存在结构数组中

    strcpy(information[nowstudentnums].s_studentID, information_buffer.s_studentID);

    strcpy(credit[nowstudentnums].studentID, information_buffer.s_studentID);

   

    //对于成绩学生无权操作,直接赋值无

    char NO[3] = "无";

    strcpy(credit[nowstudentnums].compulsory, NO);

    strcpy(credit[nowstudentnums].select, NO);

    strcpy(credit[nowstudentnums].morality, NO);

    strcpy(credit[nowstudentnums].innovate, NO);

    strcpy(credit[nowstudentnums].other, NO);

    strcpy(credit[nowstudentnums].sum, NO);

    int v = 0;

    //按键的响应

    while (1)//时刻获取鼠标信息

    {

        if (MouseHit())//如果有消息

        {

            MOUSEMSG correct_q = GetMouseMsg();//设置变量引入消息

            switch (correct_q.uMsg)//判断是什么信息

            {

            case WM_LBUTTONDOWN://左键

                //(返回)按钮

                if (correct_q.x > 16.63 && correct_q.x < 94.10 && correct_q.y>16.25 && correct_q.y < 60.47)

                {

                    studentwindows();//学生窗口

                    break;

                }

                //(姓名)格

                else if (correct_q.x > 481.84 && correct_q.x < 877.14 && correct_q.y>236.98 && correct_q.y < 274.02)

                {

                    TCHAR InputWindow_Name[] = _T("请输入你的姓名");

                    InputBox(information_buffer.s_Name, 15, InputWindow_Name);

                    //进行输出

                    outtextxy(481.84, 240, information_buffer.s_Name);

                    //保存在结构数组中

                    strcpy(information[nowstudentnums].s_Name, information_buffer.s_Name);

                    strcpy(credit[nowstudentnums].Name, information_buffer.s_Name);

                    v += 1;

                }

                //(性别)格

                else if (correct_q.x > 481.84 && correct_q.x < 877.14 && correct_q.y>274.02 && correct_q.y < 311.06)

                {

                    TCHAR InputWindow_gender[] = _T("请输入你的性别");

                    InputBox(information_buffer.s_gender, 15, InputWindow_gender);

                    //进行输出

                    outtextxy(481.84, 280, information_buffer.s_gender);

                    //保存在结构数组中

                    strcpy(information[nowstudentnums].s_gender, information_buffer.s_gender);

                    v += 1;

                }

                //(院系)格

                else if (correct_q.x > 481.84 && correct_q.x < 877.14 && correct_q.y>311.06 && correct_q.y < 348.1)

                {

                    TCHAR InputWindow_faculty[] = _T("请输入你的院系全称");

                    InputBox(information_buffer.s_faculty, 15, InputWindow_faculty);

                    //进行输出

                    outtextxy(481.84, 320, information_buffer.s_faculty);

                    //保存在结构数组中

                    strcpy(information[nowstudentnums].s_faculty, information_buffer.s_faculty);

                    v += 1;

                }

                //(专业)格

                else if (correct_q.x > 481.84 && correct_q.x < 877.14 && correct_q.y>348.1 && correct_q.y < 385.14)

                {

                    TCHAR InputWindow_speciality[] = _T("请输你的专业");

                    InputBox(information_buffer.s_speciality, 15, InputWindow_speciality);

                    //进行输出

                    outtextxy(481.84, 360, information_buffer.s_speciality);

                    //保存在结构数组中

                    strcpy(information[nowstudentnums].s_speciality, information_buffer.s_speciality);

                    v += 1;

                }

                //(年级)格

                else if (correct_q.x > 481.84 && correct_q.x < 877.14 && correct_q.y>385.14 && correct_q.y < 422.18)

                {

                    TCHAR InputWindow_grade[] = _T("请输入你的年级,例(2201)22届1班");

                    InputBox(information_buffer.s_grade, 15, InputWindow_grade);

                    //进行输出

                    outtextxy(481.84, 400, information_buffer.s_grade);

                    //保存在结构数组中

                    strcpy(information[nowstudentnums].s_grade, information_buffer.s_grade);

                    v += 1;

                }

                //(手机号)格

                else if (correct_q.x > 503.76 && correct_q.x < 877.14 && correct_q.y>422.18 && correct_q.y < 459.22)

                {

                    TCHAR InputWindow_number[] = _T("请输入你的手机号");

                    InputBox(information_buffer.s_number, 15, InputWindow_number);

                    // 进行输出

                    outtextxy(503.76, 435, information_buffer.s_number);

                    //保存在结构数组中

                    strcpy(information[nowstudentnums].s_number, information_buffer.s_number);

                    v += 1;

                }

                //(确定注册)按钮

                else if (correct_q.x > 576 && correct_q.x < 703 && correct_q.y>549 && correct_q.y < 591)

                {

                    if (v != 6)

                    {

                        HWND hn = GetHWnd();

                        int iso = MessageBox(hn, "还有数据没有输入完哦", "错误提示", MB_OKCANCEL);

                        if (iso == IDOK)

                        {

                            interdict = 1;

                            continue;

                        }

                        else if (IDCANCEL == iso)

                        {

                            interdict = 1;

                            continue;

                        }

                    }

                    else

                    {

                        FILE* correct_g;//定义输入信息文件指针

                        FILE* correct_l;//定义存取信息文件指针

                        //打开文档进行分析操作

                        correct_g = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生信息.txt", "w+");

                        correct_l = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生学分.txt", "w+");

                            //UseStudentNumber();//载入学生数目

                        int y;//循环变量

                            //int num;

                            //num = nowstudentnums + 1;

                        //存入学生数据

                            for (y = 0; y <= nowstudentnums; y++)//for (y = 0; y < 42; y++) nowstudentnums

                        {

                            //判断数据是否存完

                            if (strlen(information[y].s_studentID) == 0 && y == 42)

                            {

                                break;

                            }

                            //将结构数据保存在文件中

                            fprintf(correct_g, "%s %s %s %s %s %s %s\n",

                                information[y].s_studentID,

                                information[y].s_Name,

                                information[y].s_gender,

                                information[y].s_faculty,

                                information[y].s_speciality,

                                information[y].s_grade,

                                information[y].s_number);

                            fprintf(correct_l, "%s %s %s %s %s %s %s %s\n",

                                credit[y].studentID,

                                credit[y].Name,

                                credit[y].compulsory,

                                credit[y].select,

                                credit[y].morality,

                                credit[y].innovate,

                                credit[y].other,

                                credit[y].sum);

                        }

                        fclose(correct_g);//关闭文件

                        fclose(correct_l);//关闭文件

                        nowstudentnums = nowstudentnums + 1;//

                            SaveStudentNumber();//保存现有学生数量

                        HWND hnd = GetHWnd();

                        int isok = MessageBox(hnd, "注册成功!", "成功提示", MB_OKCANCEL);

                        if (isok == IDOK)

                        {

                            interdict = 1;

                            continue;

                        }

                        else if (IDCANCEL == isok)

                        {

                            interdict = 1;

                            continue;

                        }

                    }

                }

            }

        }

    }

}

(二十一)学生登录

void student_login()// 学生登录

{

    IMAGE correct_s;//定义界面图片指针

    loadimage(&correct_s, "E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\界面图片\\学生登录界面.png", 1280, 720);

    putimage(0, 0, &correct_s);

    settextcolor(BLACK);//设置字体颜色为黑色

    setbkmode(TRANSPARENT);//消除字体背景颜色

    settextstyle(25, 0, _T("Consolas"));//设置字体大小

     UseStudentNumber();//载入学生数目

    FILE* informationfile_s;//定义存取学生信息文件指针

    FILE* creditfile_s;//定义存取学分信息文件指针

    //打开文档进行分析操作

    informationfile_s = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生信息.txt", "r+");

    creditfile_s = fopen("E:\\C语言的软件\\VS\\系统菜单\\图片和数据存放地\\数据\\学生学分.txt", "r+");

    //提取学生学分数据

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

    {

        //判断数据是否读完

        if (feof(informationfile_s) == 1)

        {

            break;

        }

        //将文件数据保存在结构数组中

        fscanf(informationfile_s, "%s %s %s %s %s %s %s\n",

            &information[i].s_studentID,

            &information[i].s_Name,

            &information[i].s_gender,

            &information[i].s_faculty,

            &information[i].s_speciality,

            &information[i].s_grade,

            &information[i].s_number);

        fscanf(creditfile_s, "%s %s %s %s %s %s %s %s\n",

            &credit[i].studentID,

            &credit[i].Name,

            &credit[i].compulsory,

            &credit[i].select,

            &credit[i].morality,

            &credit[i].innovate,

            &credit[i].other,

            &credit[i].sum);

    }

    fclose(informationfile_s);//关闭文件

    fclose(creditfile_s);//关闭文件

    TCHAR InputWindow_studentID[] = _T("请输入你的学号");

    InputBox(information_buffer.s_studentID, 15, InputWindow_studentID);

    int u = 0;

    //定位该生所在位置

    for (u = 0; u < 42; u++)

    {

        if (strcmp(information_buffer.s_studentID, information[u].s_studentID) == 0)

        {

            break;

        }

    }

    if (u == 42)

    {

        HWND hnd = GetHWnd();

        int isok = MessageBox(hnd, "你还没有注册,请注册", "错误提示", MB_OKCANCEL);

        if (isok == IDOK)

        {

            student_registration();//学生注册

        }

        else if (IDCANCEL == isok)

        {

            studentwindows();//学生窗口

        }

    }

    //在指定的图框中显示

    outtextxy(742.6, 280, information[u].s_Name);

    outtextxy(742.6, 337, information[u].s_gender);

    outtextxy(742.6, 393, information[u].s_faculty);

    outtextxy(742.6, 452, information[u].s_speciality);

    outtextxy(742.6, 511, information[u].s_grade);

    outtextxy(762, 570, information[u].s_number);

    outtextxy(1053, 275, credit[u].compulsory);

    outtextxy(1053, 334, credit[u].select);

    outtextxy(1053, 393, credit[u].morality);

    outtextxy(1053, 452, credit[u].innovate);

    outtextxy(1053, 511, credit[u].other);

    outtextxy(1053, 570, credit[u].sum);

    //获取鼠标操作

    while (1)//时刻获取鼠标信息

    {

        if (MouseHit())//如果有消息

        {

            MOUSEMSG correct_b = GetMouseMsg();//设置变量引入消息

            switch (correct_b.uMsg)//判断是什么信息

            {

            case WM_LBUTTONDOWN://左键

                //返回按钮

                if (correct_b.x > 17.76 && correct_b.x < 60 && correct_b.y>17.76 && correct_b.y < 90)

                {

                    studentwindows();//学生窗口

                    break;

                }

            }

        }

    }

}

四、调试分析

从主界面到管理员界面或者学生界面使用Easy-x坐标定位来进行调试,再到之后的显示学生信息和学分全揽,发现是空白,什么都没有,所以推测是输入的问题,也可能是文件的问题。于是找到对应模块进行调试,进入管理员界面内的录入学生信息和学生注册,发现录入学生信息显示录入学生已满,所以现在数据已经达到了最大容量值了,但为什么还是写不上去。于是我打开文件,看了一下有42行空白,有字节数,说明是写进去了,但是没有完全将有用的数据写入,而且还有无用的数据写入,于是将对应模块的代码断点逐行调试,发现是变量nowstudentsnum的问题,基于这个问题,写了两个函数来控制认识的变化,每次需要看人数时,调用UseStudentNumber函数,用完之后,人数增加或者减少,再用SaveStudentNumber函数,来控制变量的范围,于是改了之后代码达到了预期的效果。

五、测试结果

从主界面能顺利跳转到(第一个按钮)管理员界面或者(第二个按钮)学生界面,如图1-1,进入管理员界面需要输入密码,如图1-2。

图1-1 首界面

图1-2 管理员登录密码

进入管理员界面,可以正常跳转到管理员界面,如图2-1.在管理员界面,(第一个按钮)到查看所有学生的个人信息表和学分信息表,如图2-2和2-3。(第二个按钮)可以到对学生数据进行操作(增加,删除,查找,修改),并且将操作后的数据存储到文件中。

图2-1 管理员界面

图2-2 学生学分全揽

图2-3 学生信息全揽

  进入修改,添加学生数据界面,如图3-1。有对应的4个按钮,有录入学生信息(第一个按钮),如图3-2。删除学生信息(第二个按钮),如图3-3。查找学生信息(第三个按钮),如图3-4。修改学生信息(第四个按钮),如图3-5,将学生数据进行对应的操作后可以将对应信息储存到相应的文件中。

图3-1 管理员操作全揽

图3-2 录入操作

图3-3 删除操作

图3-4 查询操作

图3-5 修改操作

进入学生界面,如图4-1。可以跳转到(第一个按钮)学生登录界面,如图4-2。或者可以跳转到(第二个按钮)学生注册界面,如图4-3。也可以点击页面返回回溯到首页面,如图4-4。进入对应的页面进行可以进行学生登录或者注册,完成流程后的同时可以直接将学生信息(如图4-5),学生学分(如图4-6),学生人数(如图4-7)直接写入文件中

图4-1 同学界面

图4-2 登录界面

图4-3 注册界面

图4-4 主界面

图4-5 学生信息存储文件

图4-6 学生学分存储文件

图4-7 学生人数存储文件

六、课程心得总结

通过完成这个学生管理系统的创作,从开始的界面,到中间的页面之间的跳转,我从学习Easy-x的函数到逐步掌握,通过写这个学生管理系统也是见证了我代码能力的成长,逐渐熟练掌握调试,断点,检查代码错误,文件的存储,页面的变换,按钮的设计,通过这次学生管理系统的创作,也是助推我代码能力的成长助推器,也愿在以后的代码求学路上,我仍能保持初心,一直走下去。

七、参考文献

[1]甘勇,李晔,卢冰.C语言程序设计[M].北京:中国铁道出版社,2014.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/46370.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Rust Result 与可恢复的错误

Result 与可恢复的错误 大部分错误并没有严重到需要程序完全停止执行。有时&#xff0c;一个函数会因为一个容易理解并做出反应的原因失败。例如&#xff0c;如果因为打开一个并不存在的文件而失败&#xff0c;此时我们可能想要创建这个文件&#xff0c;而不是终止进程。 回忆…

RT-DETR+Flask实现目标检测推理案例

今天&#xff0c;带大家利用RT-DETR&#xff08;我们可以换成任意一个模型&#xff09;Flask来实现一个目标检测平台小案例&#xff0c;其实现效果如下&#xff1a; 目标检测案例 这个案例很简单&#xff0c;就是让我们上传一张图像&#xff0c;随后选择一下置信度&#xff0c;…

GPT LangChain experimental agent - allow dangerous code

题意&#xff1a;GPT LangChain 实验性代理 - 允许危险代码 问题背景&#xff1a; Im creating a chatbot in VS Code where it will receive csv file through a prompt on Streamlit interface. However from the moment that file is loaded, it is showing a message with…

激活pytorch遇到报错usage: conda-script.py [-h] [--no-plugins] [-V] COMMAND ...

问题 今天初次尝试在pycharm上创建与激活虚拟环境&#xff0c;创建结束后&#xff0c;使用命令conda activate pytorch激活虚拟环境时出现以下报错&#xff1a; usage: conda-script.py [-h] [–no-plugins] [-V] COMMAND … conda-script.py: error: argument COMMAND: inval…

Selenium原理深度解析

在自动化测试领域&#xff0c;Selenium无疑是最受欢迎和广泛使用的工具之一。它支持多种浏览器和操作系统&#xff0c;为开发人员和测试人员提供了强大的自动化测试解决方案。本文将深入探讨Selenium的工作原理&#xff0c;包括其架构、核心组件、执行流程以及它在自动化测试中…

独立开发者系列(26)——域名与解析

域名&#xff08;英语&#xff1a;Domain Name&#xff09;&#xff0c;又称网域&#xff0c;是由一串用点分隔的名字组成的互联网上某一台计算机或计算机组的名称&#xff0c;用于在数据传输时对计算机的定位标识&#xff08;有时也指地理位置&#xff09;。 由于IP地址不方便…

postMessageXss续2

原文地址如下:https://research.securitum.com/art-of-bug-bounty-a-way-from-js-file-analysis-to-xss/ 在19年我写了一篇文章&#xff0c;是基于postMessageXss漏洞的入门教学:https://www.cnblogs.com/piaomiaohongchen/p/14727871.html 这几天浏览mXss技术的时候&#xff…

车载音视频App框架设计

简介 统一播放器提供媒体播放一致性的交互和视觉体验&#xff0c;减少各个媒体应用和场景独自开发的重复工作量&#xff0c;实现媒体播放链路的一致性&#xff0c;减少碎片化的Bug。本文面向应用开发者介绍如何快速接入媒体播放器。 主要功能&#xff1a; 新设计的统一播放U…

新版本cesium编译1.103之后的版本

cesium1.1之后的版本文件结构域1.1之前的版本有了很大的差别&#xff0c;源码也全部移到了packages目录中。有很多依赖包没有写在根目录的package.json文件中。npm i 后直接编译会保持。 cesium源码git https://github.com/CesiumGS/cesium 1、添加缺少的包&#xff0c;缺少的…

4. 双端口ram设计

1. 设计要求 设计一个位宽8bit&#xff0c;地址深度为128&#xff0c;可以同时读写的双端口RAM 要求&#xff1a;模块名字为RAM_DUAL 输入端口&#xff1a;ADDR_W&#xff0c;ADDR_R CLK_R&#xff0c;CLK_W&#xff0c;RSTn ADDR_R[6:0]&#xff0c;ADDR_W[6:0] DATA_WR…

学习测试9-接口测试 2-抓包工具Fiddler

Fiddler 抓包工具的使用 怎么找接口信息&#xff0c;可以通过浏览器的开发者工具 Fiddler 是一个 HTTP 协议调试代理工具 File 菜单&#xff1a; Capture Traffic&#xff08;或 F12&#xff09;&#xff1a;是个开关&#xff0c;可以控制是否把 Fiddler 注册为系统代理。当把…

浅谈Open.Json.pickle.Os

一、Open函数使用 open函数是 Python 中用于打开文件的内置函数&#xff0c;它返回一个文件对象&#xff0c;该文件对象提供了对文件进行读写操作的方法。使用 open 函数时&#xff0c;通常需要指定至少两个参数&#xff1a;文件名&#xff08;file&#xff09;和模式&#xf…

【网络工具】Charles 介绍及环境配置

✍个人博客&#xff1a;Pandaconda-CSDN博客 &#x1f4e3;专栏地址&#xff1a;http://t.csdnimg.cn/iAmAo &#x1f4da;专栏简介&#xff1a;在这个专栏中&#xff0c;我将会整理一些工作或学习中用到的工具介绍给大家~ &#x1f4d8;Charles 系列其它文章&#xff1a;【网络…

Git操纵本地仓库和远程仓库

git是一个代码托管的平台&#xff0c;我们可以对我们的代码进行分支 推送提交 打标签等等操作&#xff0c;而且git使用过程中也是支持一些linux语言的 比如cd呀 touch mkdir啊等等等 git的具体安装过程就不再赘述 我个人认为 好多东西就是 代码也好 文字 文档 也好&…

【C语言】结构体,枚举,联合超详解!!!

目录 结构体 结构体声明 结构体成员的访问 结构体自引用 结构体变量定义&#xff0c;初始化&#xff0c;传参 结构体内存对齐 位段 枚举 联合(共用体) 结构体 结构体声明 1. 概念 1. 结构体是一些值的集合&#xff0c;这些值称为成员变量。 2. 结构体的每个成员可…

长难句打卡7.15

The trend was naturally most obvious in those areas of science based especially on a mathematical or laboratory training, and can be illustrated in terms of the development of geology in the United Kingdom 这一趋势自然在以数学或实验室训练为基础的科学领域里…

Unlink

Unlink 原理 我们在利用 unlink 所造成的漏洞时&#xff0c;其实就是对 chunk 进行内存布局&#xff0c;然后借助 unlink 操作来达成修改指针的效果。简单回顾一下 unlink 的目的与过程&#xff0c;其目的是把一个双向链表中的空闲块拿出来&#xff08;例如 free 时和目前物理…

Leetcode二分搜索法浅析

文章目录 1.二分搜索法1.1什么是二分搜索法&#xff1f;1.2解法思路 1.二分搜索法 题目原文&#xff1a; 给定一个 n 个元素有序的&#xff08;升序&#xff09;整型数组 nums 和一个目标值 target &#xff0c;写一个函数搜索 nums 中的 target&#xff0c;如果目标值存在返…

从PyTorch官方的一篇教程说开去(1 - 初心)

原文在此&#xff0c;喜欢读原汁原味的可以自行去跟&#xff0c;这是一个非常经典和有学习意义的例子&#xff0c;在此向老爷子们致敬 - https://pytorch.org/tutorials/intermediate/reinforcement_q_learning.html 开源文化好是好&#xff0c;但是“公地的悲哀”这点避不开…

高效运维:构建全面监控与自动化管理体系

在当今的数字化时代&#xff0c;运维管理已成为企业IT架构中不可或缺的一环。它不仅关乎系统的稳定运行&#xff0c;更直接影响到业务的响应速度、故障处理时间以及客户满意度等多个方面。因此&#xff0c;构建一套全面监控与自动化管理体系&#xff0c;对于提升企业运维效率、…