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

news2024/11/15 8:41:28

     

                                                          课 程  名 称:     程序设计实践             

                                                          专     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.coloradmin.cn/o/1931945.html

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

相关文章

电瓶车检测AI算法:视频智能分析技术助力电瓶车规范与安全管理

随着电瓶车&#xff08;电动自行车&#xff09;的普及&#xff0c;其在城市交通中扮演着越来越重要的角色。然而&#xff0c;电瓶车的管理、安全监控以及维护等方面也面临着诸多挑战。近年来&#xff0c;人工智能&#xff08;AI&#xff09;技术的发展为解决这些问题提供了新的…

Ubuntu安装virtualbox(win10)

virtualbox下载安装 1、下载virtualbox 下载路径&#xff1a;Linux_Downloads – Oracle VM VirtualBox 根据自己的Ubuntu版本选择对应的安装包下载 2、安装virtualbox 到下载路径&#xff08;一般为~/Download&#xff09;打开终端输入命令 sudo dpkg -i xxx.deb 继续执…

求解答word图标变白

把WPS卸载了之后就变成白色了&#xff0c;然后在注册表中把word的地址改成office word的地址之后图标变成这样了&#xff0c;怎么办

【漏洞复现】Rejetto HTTP文件服务器——远程命令执行(CVE-2024-23692)

声明&#xff1a;本文档或演示材料仅供教育和教学目的使用&#xff0c;任何个人或组织使用本文档中的信息进行非法活动&#xff0c;均与本文档的作者或发布者无关。 文章目录 漏洞描述漏洞复现测试工具 漏洞描述 Rejetto HTTP文件服务器是一个轻量级的HTTP服务器软件&#xff…

电源芯片MPQ3431A

一、芯片介绍 MPQ3431A是一款具有宽输入范围的固定频率为450kHz的高度集成的升压转换器&#xff0c;其输入电压低至2.7V&#xff0c;采用恒定关断时间&#xff08;COT&#xff09;的控制拓扑&#xff0c;可提供快速的瞬态响应。芯片支持通过MODE管脚配置PSM&#xff08;pulse-…

redis基本类型和订阅

redis-cli -h <host> -p <port> -a <password> 其中&#xff0c;< host>是Redis服务器的主机名或IP地址&#xff0c;< port>是Redis服务器的端口号&#xff0c;< password>是Redis服务器的密码&#xff08;如果有的话&#xff09;。 set …

FPGA CFGBVS 管脚接法

说明 新设计了1个KU040 FPGA板子&#xff0c;回来之后接上JTAG FPGA不识别。做如下检查&#xff1a; 1、电源测试点均正常&#xff1b; 2、查看贴片是否有漏焊&#xff0c;检查无异常&#xff0c;设计上NC的才NC&#xff1b; 3、反复检查JTAG接线是否异常&#xff0c;贴片是…

Large Language Model系列之一:语言模型与表征学习(Language Models and Representation Learning)

语言模型与表征学习&#xff08;Language Models and Representation Learning&#xff09; 1 语言模型 N-Gram模型 from collections import defaultdictsentences [The swift fox jumps over the lazy dog.,The swift river flows under the ancient bridge.,The swift br…

C语言 ——— 编写代码,判断 整型数组 是否 有序

目录 题目要求 代码实现 题目要求 判断 整型数组 是否有序 如果 整型数组 有序输出 sorted&#xff1b;否则输出 unsorted 代码实现 #include<stdio.h> int main() {int arr[10] { 0 };int sz sizeof(arr) / sizeof(arr[0]);//输入for (int i 0; i < sz; i){s…

大数据基础:Doris重点架构原理

文章目录 Doris重点架构原理 一、Apache Doris介绍 二、Apache Doris使用场景 三、Apache Doris架构原理 四、Apache Doris 特点 Doris重点架构原理 一、Apache Doris介绍 基于 MPP 架构的高性能、实时的分析型数据库&#xff0c;以极速易用的特点被人们所熟知&#xff…

YOLOV5的输出[1,25200,85]如何理解和解析

1、25200代表着检测框的数量&#xff0c;比如我们取出第一个检测框a&#xff0c;也就是[1,1&#xff0c;85]&#xff0c;取出来之后我们解析85&#xff0c;前五个为box的中点坐标、长宽值以及置信&#xff0c;后面80我们取Max&#xff08;80个类别&#xff09;中最大值&#xf…

【解决】多个网卡导致nacos注册的服务ip有误问题

解决办法 在本地idea中启动的时候添加启动配置&#xff1a; 方法一 -Dspring.cloud.inetutils.preferred-networks你自己网卡的ip 方法二 -Dspring.cloud.nacos.discovery.ip你自己网卡的ip

朴素模式匹配算法与KMP算法(非重点)

目录 一. 朴素模式匹配算法1.1 什么是字符串的匹配模式1.2 朴素模式匹配算法1.3 通过数组下标实现朴素模式匹配算法 二. KMP算法2.1 算法分析2.2 用代码实现&#xff08;只会出现在选择题&#xff0c;考察代码的概率不大&#xff09; 三. 手算next数组四. KMP算法的进一步优化4…

【CH32V303RCT6】NB模块在CTwing下的OTA升级[实操过程篇]

一、 本篇内容简介 本篇主要通过日志打印和一些云端的显示&#xff0c;来讲解整个SOTA升级的过程。 二、实验现象 2.1、目标代码 2.2、最终效果 当我们升级成功后&#xff0c;会跳转到APP_B执行程序。 三、设计思路 根据电信云平台的OTA设计特性&#xff0c;本次设计是通过…

【自撰写】【国际象棋入门】第11课 对局实例分析(一)

第11课 对局实例分析&#xff08;一&#xff09; 本次课中&#xff0c;我们来分析一例真实的对局。对局弈于“国象联盟”APP&#xff0c;日期为2024年6月13日星期四&#xff0c;我执黑。开局伊始&#xff0c;白方的布局略占优势&#xff0c;中局阶段黑方一直保持着微弱的领先&…

[AWS]CodeCommit的创建与使用

背景&#xff1a;CodeCommit是AWS自带的代码管理仓库&#xff0c;使用起来很不顺手&#xff0c;不如自建的gitlab仓库。不足之处很多&#xff0c;比如&#xff1a;缺乏可视化工具、用户管理麻烦&#xff0c;仓库管理手段贫瘠。 老板为了简单就使用了CodeCommit进行管理&#xf…

一个用于管理多个 Node.js 版本的安装和切换开源工具

大家好&#xff0c;今天给大家分享一个用于管理多个Node.js版本的工具 NVM&#xff08;Node Version Manager&#xff09;&#xff0c;它允许开发者在同一台机器上安装和使用不同版本的Node.js&#xff0c;解决了版本兼容性问题&#xff0c;为开发者提供了极大的便利。 在开发环…

Mongodb多键索引中索引边界的混合

学习mongodb&#xff0c;体会mongodb的每一个使用细节&#xff0c;欢迎阅读威赞的文章。这是威赞发布的第93篇mongodb技术文章&#xff0c;欢迎浏览本专栏威赞发布的其他文章。如果您认为我的文章对您有帮助或者解决您的问题&#xff0c;欢迎在文章下面点个赞&#xff0c;或者关…

ubuntu搭建harbor私仓

1、环境准备 链接: https://pan.baidu.com/s/1q4XBWPd8WdyEn4l253mpUw 提取码: 7ekx --来自百度网盘超级会员v2的分享 准备一台Ubuntu 机器:192.168.124.165 将上面两个文件考入Ubuntu上面 2、安装harbor 安装Docker Harbor仓库以容器方式运行,需要先安装好docker,参考:…

移动终端的安全卫士

随着移动互联网的快速发展&#xff0c;移动端安全风险频发。设备指纹技术凭借高精度的设备识别能力&#xff0c;能够帮助企业提升移动端安全防护能力&#xff0c;精准区分合法与风险行为&#xff0c;跨行业赋能风控&#xff0c;为金融、电商、游戏等多领域提供强大的业务安全保…