1. 程式人生 > 實用技巧 >學生資訊管理系統開發

學生資訊管理系統開發

學生資訊管理系統

想起來好久沒寫部落格了,最近的一段時間是我們學校的小學期,由於忙著設計這個專案(雖然很菜),所以沒怎麼刷題,部落格也咕咕咕了好久

今天基本把所有的問題都處理了,所以我打算寫一篇總結部落格,總結一下寫專案中遇到的坑。

先看看效果:

那麼直接進入正題:

首先我是用的IDE是:VS2019(Visual Studio2019)

開發用到了 easyx圖形庫(畢竟是一個UI程式嘛)

然後採用了多檔案程式設計(就是一個噓頭而已)

我先用多檔案的思路,最後再把整個完整的程式碼放出來,只想看單檔案程式設計的請跳過

首先寫程式要先梳理思路,先要思考要實現什麼功能,這點是很重要的,有什麼想法可以先寫下來,

就算後面實際寫程式碼的時候不好實現,不寫就行(能去查資料還是儘量查資料)

這是我的需求:

當然這些所謂的功能其實後面用一個函式就能實現一個功能,我喜歡在完成這些功能後打上

然後開始分析我們需要寫一個學生端,然後寫一個教師端

登入和註冊是兩個端都共有的,所以我們發現可以寫份分檔案和一個主要的.cpp檔案(當然如果是C語言的話,就是.c 後面同上)

由於程式碼比較長,我就不逐一解釋。

多檔案程式設計操作部落格:傳送門1傳送門2傳送門3

先說.h檔案裡面存放的是結構體/類的還有該.h檔案對應的.cpp檔案裡面的函式宣告(注意只是宣告!!!)

.h對應的.c檔案裡面放的是.h裡面的宣告的函式內容(可能有點繞,請理解)

注意1:所有的結構體或者什麼宣告只能定義一次,其他的檔案想使用的話,直接#include"XXX.h"(包含需要使用的定義的標頭檔案)

注意2: 如果你在引用標頭檔案的時候遇到了標頭檔案重定義問題,你可以使用#ifndef/#define/#endif 操作方法:傳送門

我們先來看公共部分的分檔案操作:

MAIN.h:

#pragma once
#include<cstdio>
#include"hstudent.h"
#include"hteacher.h"
#include"MAIN.h"
extern class List1* L1;//第一個學生
extern class List2* L2;//
第一個老師 extern SYSTEMTIME st; extern int X , Y ;//X:介面寬度 Y介面高度 extern int randnum; extern HWND HD; extern char qiandaoyuji[][50]; class List1* add_stu(class student* p, class List1* L);//學生資訊新增 名字,學號,初始化學生資訊 class List2* add_tea(class teacher* p, class List2* L);//初始化老師資訊 int find_ID(class student* p1, class teacher* p2, class List1* L_1, class List2* L_2); bool save1(List1* p1);//學生檔案儲存函式 bool save2(List2* p2);//教師檔案儲存函式 void read(class List1* p1, class List2* p2);//檔案讀取函式 void Pregister();//註冊 void Plog();//登入 void PMAIN();//主介面

存放的就是函式和結構體還有一些全域性變數的引用

MAIN.cpp:

#pragma once
#include<easyx.h>
#include<graphics.h>
#include<cstdio>
#include<iostream>
#include<windows.h>
#include<cstring>
#include<conio.h>
#include<vector>
#include<queue>
#include<algorithm>
#include <atlstr.h>
#include<ctime>
#include"hstudent.h"
#include"hteacher.h"
#include"MAIN.h"
#pragma comment(lib,"Winmm.lib")
using namespace std;
List1* add_stu(student* p, List1* L)//學生資訊新增  名字,學號,初始化學生資訊
{
    student* temp = (student*)malloc(sizeof(student));
    ::memset(temp, 0, sizeof(temp));
    ::memset(temp->Data.cfxinxi.name, 0, sizeof(temp->Data.cfxinxi.name));
    ::memset(temp->Data.hjxinxi.name, 0, sizeof(temp->Data.hjxinxi.name));
    ::memset(&temp->Data.all_kemu, 0, sizeof(temp->Data.all_kemu));
    ::memset(temp->Data.kebiao, 0, sizeof(temp->Data.kebiao));
    temp->Data.cfxinxi.loc = 0;
    temp->Data.all_kemu.score = 0;
    temp->next = NULL;
    temp->Data.hjxinxi.loc = 0;//獲獎
    temp->Data.lastqiandao = p->Data.lastqiandao;//簽到資訊,每次登入都會重新置為0,別問為什麼,問就是不會實時更新。°(°¯᷄◠¯᷅°)°。
    GetLocalTime(&st);
    if (temp->Data.lastqiandao == (st.wYear * 365 + st.wMonth * 30 + st.wDay))
    {
        temp->Data.qiandao = 1;
    }
    else
    {
        temp->Data.qiandao = 0;
    }
    if (*p->Data.ID != '\0')
        strcpy_s(temp->Data.ID, (p->Data.ID));//拷貝學生ID
    if (*p->Data.name != '\0')
        strcpy_s(temp->Data.name, (p->Data.name));//拷貝學生名字
    if (*p->Data.mima != '\0')
        strcpy_s(temp->Data.mima, (p->Data.mima));//拷貝學生密碼
    if (p->Data.cfxinxi.loc)//拷貝處分資訊
    {
        add_chufen(&p->Data.cfxinxi, temp);
    }
    if (p->Data.hjxinxi.loc)//拷貝獲獎資訊
    {
        add_huojiang(&p->Data.hjxinxi, temp);
    }
    //成績錄入
    temp->Data.all_kemu.yuwen = p->Data.all_kemu.yuwen;
    temp->Data.all_kemu.shuxue = p->Data.all_kemu.shuxue;
    temp->Data.all_kemu.yingyu = p->Data.all_kemu.yingyu;
    temp->Data.all_kemu.wuli = p->Data.all_kemu.wuli;
    temp->Data.all_kemu.huaxue = p->Data.all_kemu.huaxue;
    temp->Data.all_kemu.Cyuyan = p->Data.all_kemu.Cyuyan;
    temp->Data.all_kemu.score = p->Data.all_kemu.score;//p->Data.all_kemu.yuwen + p->Data.all_kemu.shuxue + p->Data.all_kemu.yingyu + p->Data.all_kemu.wuli + p->Data.all_kemu.huaxue + p->Data.all_kemu.Cyuyan;

    //課表讀取
    for (int i = 0; i < 25; ++i)
    {
        strcpy_s(temp->Data.kebiao[i], p->Data.kebiao[i]);
    }
    student* pp = L->head;
    if (pp != NULL)//如果已有多個學生資訊
    {
        while (pp->next)//找到指標末尾
            pp = pp->next;
        pp->next = temp;
    }
    else//如果為第一個學生
    {
        L->head = temp;
    }
    return L;
}
List2* add_tea(teacher* p, List2* L)//初始化老師資訊
{
    teacher* temp = (teacher*)malloc(sizeof(teacher));
    temp->next = NULL;
    if (*p->Data.ID != '\0')
        strcpy_s(temp->Data.ID, p->Data.ID);//拷貝ID
    if (*p->Data.mima != '\0')
        strcpy_s(temp->Data.mima, p->Data.mima);//拷貝密碼
    if (*p->Data.name != '\0')
        strcpy_s(temp->Data.name, p->Data.name);//拷貝名字
    teacher* pp = L->head;
    if (pp)
    {
        while (pp->next)
            pp = pp->next;
        pp->next = temp;
    }
    else
        L->head = temp;
    return L;
}
void add_huojiang(huojiang* hj, student* L)//學生獲獎資訊新增 用於初始化
{

    for (int i = 0; i < hj->loc && L->Data.hjxinxi.loc < 10 && i < 10; ++i)
    {
        strcpy_s(L->Data.hjxinxi.name[L->Data.hjxinxi.loc++], hj->name[i]);
    }
    return;
}
void add_chufen(chufen* cf, student* L)//新增學生處分資訊 用於初始化時
{

    for (int i = 0; i < cf->loc && i < 10 && L->Data.cfxinxi.loc < 10; ++i)
    {
        strcpy_s(L->Data.cfxinxi.name[L->Data.cfxinxi.loc++], cf->name[i]);
    }
    return;
}
bool save1(List1* p1)
{
    student* pp1;
    FILE* fp1 = NULL;
    fp1 = fopen("student.txt", "wb");
    for (pp1 = p1->head; pp1 != NULL; pp1 = pp1->next)
    {
        fwrite(pp1, sizeof(student), 1, fp1);
    }
    fclose(fp1);
    return true;
}
bool save2(List2* p2)
{
    teacher* pp2;
    FILE* fp2 = NULL;
    fp2 = fopen("teacher.txt", "wb");
    if (fp2 == NULL)
    {
        printf("kk");
    }
    for (pp2 = p2->head; pp2 != NULL; pp2 = pp2->next)
    {
        fwrite(pp2, sizeof(teacher), 1, fp2);
    }
    fclose(fp2);
    return true;
}
void read(List1* p1, List2* p2)
{
    student* s1 = (student*)malloc(sizeof(student));
    teacher* s2 = (teacher*)malloc(sizeof(student));
    chufen* cf1 = (chufen*)malloc(sizeof(chufen));
    ::memset(cf1->name, 0, sizeof(cf1->name));
    cf1->loc = 0;
    ::memset(s1->Data.cfxinxi.name, 0, sizeof(s1->Data.cfxinxi.name));
    s1->Data.cfxinxi.loc = 0;
    FILE* fp1 = NULL;
    FILE* fp2 = NULL;
    fp1 = fopen("student.txt", "rb");
    if (fp1 == NULL)
    {
        fp1 = fopen("student.txt", "wb");
        goto out1;
    }
    while (fread(s1, sizeof(student), 1, fp1))
    {
        L1 = add_stu(s1, p1);
    }
out1:
    fclose(fp1);
    fp2 = fopen("teacher.txt", "rb");
    if (fp2 == NULL)
    {
        fopen("teacher.txt", "wb");
        return;
    }
    while (fread(s2, sizeof(teacher), 1, fp2) != 0)
    {
        L2 = add_tea(s2, p2);
    }
    fclose(fp2);
}
void Plog()//登入介面
{
    cleardevice();

    IMAGE pmain;//登入註冊介面
    IMAGE tp;
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(360, 200, L"西柚資訊管理登陸");
    rectangle(520, 360, 850, 410);
    rectangle(520, 450, 850, 500);
    rectangle(520, 540, 850, 590);
    rectangle(0, 0, 100, 50);
    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(420, 365, L"學號:");
    outtextxy(420, 455, L"密碼:");
    outtextxy(640, 545, L"登入");
    outtextxy(5, 5, L"返回");
    MOUSEMSG mg;
    student* stu = (student*)malloc(sizeof(student));
    teacher* tea = (teacher*)malloc(sizeof(teacher));
    wchar_t xuehao[20];
    ::memset(xuehao, 0, sizeof(xuehao));
    wchar_t mima[20];
    ::memset(mima, 0, sizeof(mima));
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)//返回主介面
        {
            PMAIN();
        }
        else if (mg.x > 520 && mg.x < 850 && mg.y>360 && mg.y < 410 && mg.uMsg == WM_LBUTTONUP)//學號輸入
        {
            setbkcolor(getpixel(521, 361));
            clearrectangle(520, 360, 850, 410);
            rectangle(520, 360, 850, 410);
            InputBox(xuehao, 13, L"請輸入學號");
            WideCharToMultiByte(CP_ACP, 0, xuehao, -1, stu->Data.ID, wcslen(xuehao) * 2 + 1, NULL, NULL);
            WideCharToMultiByte(CP_ACP, 0, xuehao, -1, tea->Data.ID, wcslen(xuehao) * 2 + 1, NULL, NULL);
            outtextxy(525, 365, xuehao);
        }
        else if (mg.x > 520 && mg.x < 850 && mg.y>450 && mg.y < 500 && mg.uMsg == WM_LBUTTONUP)//密碼輸入
        {
            setbkcolor(getpixel(521, 451));
            clearrectangle(520, 450, 850, 500);
            rectangle(520, 450, 850, 500);
            InputBox(mima, 13, L"請輸入密碼");
            WideCharToMultiByte(CP_ACP, 0, mima, -1, stu->Data.mima, wcslen(mima) * 2 + 1, NULL, NULL);
            WideCharToMultiByte(CP_ACP, 0, mima, -1, tea->Data.mima, wcslen(mima) * 2 + 1, NULL, NULL);
            outtextxy(525, 460, mima);
        }
        else if (mg.x > 520 && mg.x < 850 && mg.y>540 && mg.y < 590 && mg.uMsg == WM_LBUTTONUP)//登入
        {

            int flag = find_ID(stu, tea, L1, L2);
            if (flag)
            {

                if (flag == 1)//學生賬號
                {
                    student* k1 = NULL;
                    k1 = find_student(stu, L1);
                    outtextxy(520, 700, L"學生登入成功");
                    Sleep(1000);
                    Pstudent(k1);
                }
                else if (flag == 2)//老師賬號
                {
                    teacher* k2 = NULL;
                    k2 = find_teacher(tea, L2);
                    outtextxy(560, 700, L"老師登入成功");
                    Sleep(100);
                    Pteacher(k2);
                }
                else if (flag == -1)//學生密碼錯誤
                {
                    MessageBox(HD, L"密碼錯誤,請重新輸入", L"登入資訊", MB_OK);
                }
                else if (flag == -2)//學生密碼錯誤
                {
                    MessageBox(HD, L"密碼錯誤,請重新輸入", L"登入資訊", MB_OK);
                }
            }
            else
            {
                MessageBox(HD, L"此賬號並不存在", L"登入資訊", MB_OK);
            }
        }

    }
}
void PMAIN()//主介面,初始介面
{
    cleardevice();
    IMAGE pmain;//登入註冊介面
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(360, 200, L"西柚資訊管理登陸");
    rectangle(520, 360, 690, 410);
    rectangle(520, 450, 690, 500);
    rectangle(1100, 750, 1199, 799);
    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(565, 365, L"登入");
    outtextxy(565, 455, L"註冊");
    outtextxy(1110, 755, L"退出");
    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 520 && mg.x < 690)
        {
            if (mg.y > 360 && mg.y < 410 && mg.uMsg == WM_LBUTTONUP)//登入
            {
                Plog();
            }
            else if (mg.y > 450 && mg.y < 500 && mg.uMsg == WM_LBUTTONUP)//註冊
            {
                Pregister();
            }
        }
        else if (mg.x > 1100 && mg.x < 1200 && mg.y>750 && mg.y < 800 && mg.uMsg == WM_LBUTTONUP)
        {
            exit(0);
        }
    }
}
void Pregister()//註冊介面
{
    cleardevice();
    IMAGE pmain;//登入註冊介面
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(350, 50, L"西柚資訊管理登陸");
    rectangle(520, 120, 850, 180);//賬號框
    rectangle(520, 220, 850, 280);//密碼框
    rectangle(520, 320, 850, 380);//姓名框
    rectangle(320, 420, 490, 480);//學生註冊框
    rectangle(720, 420, 890, 480);//教師註冊框
    rectangle(0, 0, 100, 50);
    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(5, 5, L"返回");
    settextstyle(30, 18, L"微軟雅黑");
    outtextxy(420, 130, L"賬號");
    outtextxy(420, 230, L"密碼");
    outtextxy(420, 330, L"姓名");
    outtextxy(330, 430, L"學生註冊");
    outtextxy(730, 430, L"教師註冊");
    student* stu = (student*)malloc(sizeof(student));
    teacher* tea = (teacher*)malloc(sizeof(student));
    stu->Data.cfxinxi.loc = 0;
    stu->Data.hjxinxi.loc = 0;
    ::memset(stu, 0, sizeof(student));
    ::memset(tea, 0, sizeof(teacher));
    MOUSEMSG mg;
    wchar_t zhanghao[20];
    wchar_t mima[20];
    wchar_t mingzi[20];
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 520 && mg.x < 850)
        {
            if (mg.y > 120 && mg.y < 180 && mg.uMsg == WM_LBUTTONUP)//賬號
            {
                setbkcolor(getpixel(521, 121));
                clearrectangle(520, 120, 850, 180);
                rectangle(520, 120, 850, 180);
                InputBox(zhanghao, 13, L"請輸入賬號/學號");
                outtextxy(530, 130, zhanghao);
                WideCharToMultiByte(CP_ACP, 0, zhanghao, -1, stu->Data.ID, wcslen(zhanghao) * 2 + 1, NULL, NULL);
                WideCharToMultiByte(CP_ACP, 0, zhanghao, -1, tea->Data.ID, wcslen(zhanghao) * 2 + 1, NULL, NULL);
            }
            else if (mg.y > 220 && mg.y < 280 && mg.uMsg == WM_LBUTTONUP)//密碼
            {
                setbkcolor(getpixel(521, 221));
                clearrectangle(520, 220, 850, 280);
                rectangle(520, 220, 850, 280);
                InputBox(mima, 13, L"請輸入密碼");
                outtextxy(530, 230, mima);
                WideCharToMultiByte(CP_ACP, 0, mima, -1, stu->Data.mima, wcslen(mima) * 2 + 1, NULL, NULL);
                WideCharToMultiByte(CP_ACP, 0, mima, -1, tea->Data.mima, wcslen(mima) * 2 + 1, NULL, NULL);
            }
            else if (mg.y > 320 && mg.y < 380 && mg.uMsg == WM_LBUTTONUP)//姓名
            {
                setbkcolor(getpixel(521, 321));
                clearrectangle(520, 320, 850, 380);
                rectangle(520, 320, 850, 380);
                InputBox(mingzi, 13, L"請輸入姓名");
                outtextxy(530, 330, mingzi);
                WideCharToMultiByte(CP_ACP, 0, mingzi, -1, stu->Data.name, wcslen(mingzi) * 2 + 1, NULL, NULL);
                WideCharToMultiByte(CP_ACP, 0, mingzi, -1, tea->Data.name, wcslen(mingzi) * 2 + 1, NULL, NULL);
            }
        }
        else if (mg.y > 420 && mg.y < 480)//註冊
        {

            if (mg.x > 320 && mg.x < 490 && mg.uMsg == WM_LBUTTONUP)
            {
                if (*stu->Data.ID == '\0')
                {
                    MessageBox(HD, L"請先輸入學號", L"註冊資訊", MB_OK);
                }
                else if (*stu->Data.mima == '\0')
                {
                    MessageBox(HD, L"請先輸入密碼", L"註冊資訊", MB_OK);
                }
                else if (*stu->Data.name == '\0')
                {
                    MessageBox(HD, L"請先輸入姓名", L"註冊資訊", MB_OK);
                }
                else
                {
                    int flag = find_ID(stu, tea, L1, L2);
                    if (!flag)
                    {
                        chufen* chuf = (chufen*)malloc(sizeof(chufen));
                        ::memset(chuf, 0, sizeof(chuf));
                        ::memset(chuf->name, 0, sizeof(chuf->name));
                        chuf->loc = 1;
                        strcpy_s(chuf->name[0], "暫無處分");
                        add_chufen(chuf, stu);

                        huojiang huoj;
                        ::memset(&huoj, 0, sizeof(huoj));
                        ::memset(huoj.name, 0, sizeof(huoj.name));
                        huoj.loc = 1;
                        strcpy_s(huoj.name[0], "暫無獲獎");
                        add_huojiang(&huoj, stu);
                        ::memset(&stu->Data.all_kemu, 0, sizeof(stu->Data.all_kemu));
                        stu->Data.all_kemu.score = stu->Data.all_kemu.yuwen = stu->Data.all_kemu.shuxue = stu->Data.all_kemu.yingyu = stu->Data.all_kemu.wuli = stu->Data.all_kemu.huaxue = stu->Data.all_kemu.Cyuyan = 0;
                        stu->Data.qiandao = 0;
                        stu->Data.lastqiandao = 0;

                        ::memset(stu->Data.kebiao, 0, sizeof(stu->Data.kebiao));
                        L1 = add_stu(stu, L1);
                        save1(L1);
                        MessageBox(HD, L"學生註冊成功", L"註冊資訊", MB_OK);
                        PMAIN();
                    }
                    else
                    {
                        MessageBox(HD, L"該學號已經註冊過", L"註冊資訊", MB_OK);
                    }
                }
            }
            else if (mg.x > 720 && mg.x < 890 && mg.uMsg == WM_LBUTTONUP)
            {
                int flag = find_ID(stu, tea, L1, L2);
                if (!flag)
                {
                    L2 = add_tea(tea, L2);
                    save2(L2);
                    MessageBox(HD, L"教師註冊成功", L"註冊資訊", MB_OK);
                    PMAIN();
                }
            }
        }
        else if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            PMAIN();
        }
    }
}
int find_ID(student* p1, teacher* p2, List1* L_1, List2* L_2)
{
    class student* pp1 = L_1->head;
    class teacher* pp2 = L_2->head;
    while (pp1)//查詢ID是否是學生
    {
        if (!strcmp(pp1->Data.ID, p1->Data.ID))
        {
            if (!strcmp(pp1->Data.mima, p1->Data.mima))
                return 1;//是學生返回1
            else
                return -1;//密碼錯誤
        }
        pp1 = pp1->next;
    }
    while (pp2)//查詢是不是老師
    {
        if (!strcmp(pp2->Data.ID, p2->Data.ID))
        {
            if (!strcmp(pp2->Data.mima, p2->Data.mima))
                return 2;//是老師返回2
            else
                return -1;//老師密碼錯誤
        }
        pp2 = pp2->next;
    }
    return 0;//並不存在這個賬號
}
View Code

cpp存放的就是這些函式的實現

先看學生端的分檔案:

hstudennt.h:

#pragma once
#include<cstdio>
#include"hstudent.h"
#include"hteacher.h"
#include"MAIN.h"
extern class List1* L1;//第一個學生  extern表示的是這個全域性變數在其他檔案定義過,所以直接定義就行,是起到一個修飾的作用
extern class List2* L2;//第一個老師
extern SYSTEMTIME st;
extern int X , Y ;//X:介面寬度 Y介面高度
extern int randnum;
extern HWND HD;
extern char qiandaoyuji[][50];
class data2//老師的資料
{
public:
    char ID[20];//賬號
    char mima[30];//密碼
    char name[30];//名字
};
class teacher
{
public:
    class data2 Data;
    class teacher* next;//指向下一個位置的指標
};
class List2//老師端,這樣更方便記錄資訊
{
public:
    class teacher* head;
};
void Pteacher(teacher* tea);
void Pteacher_GCJ(teacher* tea);
void Pteacher_GHJ(teacher* tea);
void Pteacher_KPM(teacher* tea);
void Pteacher_GMA(teacher* tea);
void Pteacher_CKQD(teacher* tea);
void Pteacherr_GCF(teacher* tea);
teacher* find_teacher(teacher* tea, List2* L);

這個.h檔案存放的是老師端所有操作的宣告(包括類的宣告,那些操作函式的宣告)

hstudent.cpp(注意和.h檔名稱保持一致):

#pragma once
#include<easyx.h>
#include<graphics.h>
#include<cstdio>
#include<iostream>
#include<windows.h>
#include<cstring>
#include<conio.h>
#include<vector>
#include<queue>
#include<algorithm>
#include <atlstr.h>
#include<ctime>
#include"hstudent.h"
#include"MAIN.h"
#include"hteacher.h"
#pragma comment(lib,"Winmm.lib")
using namespace std;

void Pstudent(student* stu)
{
    cleardevice();
    IMAGE pmain;//背景
    IMAGE tx1, tx2;

    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    //loadimage(&tx2, L"tx2.jpg", 200, 300);
    loadimage(&tx1, L"tx1.jpg", 200, 300);
    //putimage(1000, 0, &tx2, NOTSRCERASE);
    putimage(1000, 0, &tx1);// , SRCINVERT);

    setbkmode(TRANSPARENT);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(370, 100, L"西柚資訊管理學生端");
    rectangle(1000, 0, 1200, 300);//頭像
    rectangle(1100, 300, 1200, 350);//簽到按鈕
    rectangle(500, 200, 700, 250);//成績檢視
    rectangle(500, 300, 700, 350);//排名檢視
    rectangle(500, 400, 700, 450);//獲獎情況檢視
    rectangle(500, 500, 700, 550);//學習資料推薦
    rectangle(500, 600, 700, 650);//課表檢視
    rectangle(500, 700, 700, 750);//處分資訊檢視
    rectangle(1100, 750, 1199, 799);//退出程式
    rectangle(0, 0, 100, 50);
    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(5, 5, L"返回");//返回
    settextstyle(30, 15, L"微軟雅黑");//簽到字型
    outtextxy(1120, 310, L"簽到");//簽到
    outtextxy(1120, 760, L"退出");//退出程式
    settextstyle(40, 20, L"微軟雅黑");//選項資訊字型格式
    outtextxy(520, 205, L"我的成績");//我的成績
    outtextxy(520, 305, L"我的排名");//我的排名
    outtextxy(520, 405, L"獲獎情況");//獲獎情況
    outtextxy(520, 505, L"學習資料");//學習資料
    outtextxy(520, 605, L"我的課表");//我的課表
    outtextxy(520, 705, L"我的處分");//我的處分
    outtextxy(100, 100, CString(stu->Data.name));//學生名字
    if (stu->Data.qiandao)
    {
        settextstyle(20, 10, L"微軟雅黑");
        outtextxy(720, 400, CString(qiandaoyuji[randnum % 20]));
    }

    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 500 && mg.x < 700)
        {
            if (mg.y > 200 && mg.y < 250 && mg.uMsg == WM_LBUTTONUP)//我的成績的範圍
            {
                Pstudent_chengji(stu);
            }
            else if (mg.y > 300 && mg.y < 350 && mg.uMsg == WM_LBUTTONUP)//我的排名的範圍
            {
                Pstudent_paiming(stu);
            }
            else if (mg.y > 400 && mg.y < 450 && mg.uMsg == WM_LBUTTONUP)//獲獎情況的範圍
            {
                Pstudent_huojiang(stu);
            }
            else if (mg.y > 500 && mg.y < 550 && mg.uMsg == WM_LBUTTONUP)//學習資料的範圍
            {
                Pstudent_xuexi(stu);
            }
            else if (mg.y > 600 && mg.y < 650 && mg.uMsg == WM_LBUTTONUP)//我的課表的範圍
            {
                Pstudent_kebiao(stu);
            }
            else if (mg.y > 700 && mg.y < 750 && mg.uMsg == WM_LBUTTONUP)//我的處分的範圍
            {
                Pstudent_chufen(stu);
            }
        }
        else if (mg.x > 1100 && mg.x < 1200)//簽到的範圍
        {
            if (mg.y > 300 && mg.y < 350 && mg.uMsg == WM_LBUTTONUP)
            {
                Pstudent_qiandao(stu);
            }
            else if (mg.y > 750 && mg.y < 800 && mg.uMsg == WM_LBUTTONUP)
            {
                save1(L1);
                save2(L2);
                exit(0);
            }
        }
        else if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            PMAIN();
        }
    }

}
void Pstudent_qiandao(student* stu)//簽到
{
    if (stu->Data.qiandao)
    {
        MessageBox(HD, L"已經簽到過啦>_<", L"簽到資訊", MB_OK);
    }
    else
    {
        stu->Data.qiandao = 1;
        GetLocalTime(&st);
        stu->Data.lastqiandao = st.wYear * 365 + st.wMonth * 30 + st.wDay;
        MessageBox(HD, L"簽到成功 ◍'ㅅ'◍ ♡", L"簽到資訊", MB_OK);
        settextstyle(20, 10, L"微軟雅黑");
        outtextxy(800, 400, CString(qiandaoyuji[randnum % 20]));
    }
}
void Pstudent_chengji(student* stu)//學生成績
{
    cleardevice();
    IMAGE pmain;//主介面圖片
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    char ch[30];
    settextstyle(40, 20, L"微軟雅黑");
    rectangle(0, 0, 100, 50);
    outtextxy(5, 5, L"返回");
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(360, 50, L"我的成績 o(*≧▽≦)ツ");
    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(360, 150, L"我的語文成績:");
    outtextxy(360, 200, L"我的數學成績:");
    outtextxy(360, 250, L"我的英語成績:");
    outtextxy(360, 300, L"我的化學成績:");
    outtextxy(360, 350, L"我的物理成績:");
    outtextxy(360, 400, L"我的C語言成績:");
    if (stu->Data.all_kemu.yuwen < 60)
        settextcolor(RED);
    else if (stu->Data.all_kemu.yuwen < 80)
        settextcolor(YELLOW);
    else
        settextcolor(GREEN);
    ::sprintf(ch, "%d", stu->Data.all_kemu.yuwen);
    outtextxy(700, 150, CString(ch));
    if (stu->Data.all_kemu.shuxue < 60)
        settextcolor(RED);
    else if (stu->Data.all_kemu.shuxue < 80)
        settextcolor(YELLOW);
    else
        settextcolor(GREEN);
    ::sprintf(ch, "%d", stu->Data.all_kemu.shuxue);
    outtextxy(700, 200, CString(ch));
    if (stu->Data.all_kemu.yingyu < 60)
        settextcolor(RED);
    else if (stu->Data.all_kemu.yingyu < 80)
        settextcolor(YELLOW);
    else
        settextcolor(GREEN);
    ::sprintf(ch, "%d", stu->Data.all_kemu.yingyu);
    outtextxy(700, 250, CString(ch));
    if (stu->Data.all_kemu.huaxue < 60)
        settextcolor(RED);
    else if (stu->Data.all_kemu.huaxue < 80)
        settextcolor(YELLOW);
    else
        settextcolor(GREEN);
    ::sprintf(ch, "%d", stu->Data.all_kemu.huaxue);
    outtextxy(700, 300, CString(ch));
    if (stu->Data.all_kemu.wuli < 60)
        settextcolor(RED);
    else if (stu->Data.all_kemu.wuli < 80)
        settextcolor(YELLOW);
    else
        settextcolor(GREEN);
    ::sprintf(ch, "%d", stu->Data.all_kemu.wuli);
    outtextxy(700, 350, CString(ch));
    if (stu->Data.all_kemu.Cyuyan < 60)
        settextcolor(RED);
    else if (stu->Data.all_kemu.Cyuyan < 80)
        settextcolor(YELLOW);
    else
        settextcolor(GREEN);
    ::sprintf(ch, "%d", stu->Data.all_kemu.Cyuyan);
    outtextxy(700, 400, CString(ch));
    settextcolor(WHITE);
    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            Pstudent(stu);
        }
    }

}
void Pstudent_paiming(student* stu)//排名功能
{
    cleardevice();
    IMAGE pmain;//主介面圖片
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    char ch[30];
    settextstyle(40, 20, L"微軟雅黑");
    rectangle(0, 0, 100, 50);
    outtextxy(5, 5, L"返回");
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(360, 50, L"我的排名 ︿( ̄︶ ̄)︿");
    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(360, 150, L"我的語文排名:");
    outtextxy(360, 200, L"我的數學排名:");
    outtextxy(360, 250, L"我的英語排名:");
    outtextxy(360, 300, L"我的化學排名:");
    outtextxy(360, 350, L"我的物理排名:");
    outtextxy(360, 400, L"我的C語言排名:");
    outtextxy(360, 450, L"我的總分排名:");

    student* p = L1->head;
    int rank[7] = { 1,1,1,1,1,1,1 };
    for (; p != NULL; p = p->next)
    {
        if (strcmp(stu->Data.ID, p->Data.ID))
        {
            if (stu->Data.all_kemu.yuwen < p->Data.all_kemu.yuwen)
                rank[0]++;
            if (stu->Data.all_kemu.shuxue < p->Data.all_kemu.shuxue)
                rank[1]++;
            if (stu->Data.all_kemu.yingyu < p->Data.all_kemu.huaxue)
                rank[2]++;
            if (stu->Data.all_kemu.wuli < p->Data.all_kemu.wuli)
                rank[3]++;
            if (stu->Data.all_kemu.huaxue < p->Data.all_kemu.huaxue)
                rank[4]++;
            if (stu->Data.all_kemu.Cyuyan < p->Data.all_kemu.Cyuyan)
                rank[5]++;
            if (stu->Data.all_kemu.score < p->Data.all_kemu.score)
                rank[6]++;
        }
    }
    for (int i = 150, j = 0; j < 7; i += 50, ++j)
    {
        ::sprintf(ch, "%d", rank[j]);
        outtextxy(700, i, CString(ch));
    }

    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            Pstudent(stu);
        }

    }
}
void Pstudent_huojiang(student* stu)//獲獎情況
{
    cleardevice();
    IMAGE pmain;//主介面圖片
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(360, 50, L"我的獲獎 <( ̄︶ ̄)>");
    settextstyle(40, 20, L"微軟雅黑");
    rectangle(0, 0, 100, 50);
    outtextxy(5, 5, L"返回");
    for (int high = 100, i = 0; i < stu->Data.hjxinxi.loc; i++, high += 50)
    {
        if (*stu->Data.hjxinxi.name[i] != '\0')
            outtextxy(300, high, CString(stu->Data.hjxinxi.name[i]));
    }

    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            Pstudent(stu);
        }
    }
}
void Pstudent_xuexi(student* stu)//學習資料
{
    cleardevice();
    IMAGE pmain;//主介面圖片
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(360, 50, L"西柚資訊學習資料");
    settextstyle(40, 20, L"微軟雅黑");
    rectangle(0, 0, 100, 50);
    outtextxy(5, 5, L"返回");
    outtextxy(100, 150, L"學習網址推薦");
    outtextxy(700, 150, L"學習書籍推薦");
    settextstyle(30, 15, L"微軟雅黑");//網址和書籍字型
    //網址推薦
    outtextxy(100, 200, L"www.cnblogs.com/YHH520/");//我的部落格
    outtextxy(100, 250, L"www.nowcoder.com");//牛客
    outtextxy(100, 300, L"www.icourse163.org");//Mooc 
    outtextxy(100, 350, L"www.luogu.com.cn");//洛谷
    outtextxy(100, 400, L"github.com");//github
    outtextxy(100, 450, L"leetcode-cn.com");//leetcode
    outtextxy(100, 500, L"47.94.129.140/ //西柚的練習網址");//SWPUACM
    outtextxy(100, 550, L"www.bilibili.com");//B站
    //書籍推薦
    outtextxy(700, 200, L"C Primer Plus");
    outtextxy(700, 250, L"資料結構");
    outtextxy(700, 300, L"計算機組成原理");
    outtextxy(700, 350, L"挑戰程式設計競賽");
    outtextxy(700, 400, L"演算法競賽入門經典");
    outtextxy(700, 450, L"演算法導論");
    outtextxy(700, 500, L"程式設計之美");
    outtextxy(700, 550, L"劍指Offer");
    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            Pstudent(stu);
        }
    }
}
void Pstudent_kebiao(student* stu)//課表檢視
{
    cleardevice();
    IMAGE pmain;//主介面圖片
    wchar_t key1[20];
    char key2[20];
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(400, 50, L"我的課表");
    settextstyle(40, 20, L"微軟雅黑");
    rectangle(0, 0, 100, 50);
    outtextxy(5, 5, L"返回");
    outtextxy(220, 250, L"星期一");
    outtextxy(420, 250, L"星期二");
    outtextxy(620, 250, L"星期三");
    outtextxy(820, 250, L"星期四");
    outtextxy(1020, 250, L"星期五");
    outtextxy(30, 330, L"早自習");
    outtextxy(30, 490, L"上午");
    outtextxy(30, 690, L"下午");
    for (int i = 300; i < 799; i += 100)
    {
        line(200, i, 1200, i);
    }

    for (int i = 200; i < 1199; i += 200)
    {
        line(i, 300, i, 800);
    }
    line(200, 799, 1200, 799);
    line(1199, 300, 1199, 799);
    for (int i = 0, n = 300; i < 5; ++i, n += 100)
    {
        for (int j = 0, m = 200; j < 5; ++j, m += 200)
        {
            outtextxy(m + 20, n + 20, CString(stu->Data.kebiao[i * 5 + j]));
        }
    }

    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            Pstudent(stu);
        }
        else if (mg.y > 300 && mg.y < 400)//第一行
        {
            if (mg.x > 200 && mg.x < 400 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(201, 301));
                clearrectangle(200, 300, 400, 400);
                rectangle(200, 300, 400, 400);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[0], key2);
                outtextxy(220, 320, CString(key2));
                save1(L1);
            }
            else if (mg.x > 400 && mg.x < 600 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(401, 301));
                clearrectangle(400, 300, 600, 400);
                rectangle(400, 300, 600, 400);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[1], key2);
                outtextxy(420, 320, CString(key2));
                save1(L1);
            }
            else if (mg.x > 600 && mg.x < 800 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(601, 301));
                clearrectangle(600, 300, 800, 400);
                rectangle(600, 300, 800, 400);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[2], key2);
                outtextxy(620, 320, CString(key2));
                save1(L1);
            }
            else if (mg.x > 800 && mg.x < 1000 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(801, 301));
                clearrectangle(800, 300, 1000, 400);
                rectangle(800, 300, 1000, 400);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[3], key2);
                outtextxy(820, 320, CString(key2));
                save1(L1);
            }
            else if (mg.x > 1000 && mg.x < 1200 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(1001, 301));
                clearrectangle(1000, 300, 1200, 400);
                rectangle(1000, 300, 1199, 400);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[4], key2);
                outtextxy(1020, 320, CString(key2));
                save1(L1);
            }
        }
        else if (mg.y > 400 && mg.y < 500)//第二行
        {
            if (mg.x > 200 && mg.x < 400 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(201, 401));
                clearrectangle(200, 400, 400, 500);
                rectangle(200, 400, 400, 500);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[5], key2);
                outtextxy(220, 420, CString(key2));
                save1(L1);
            }
            else if (mg.x > 400 && mg.x < 600 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(401, 401));
                clearrectangle(400, 400, 600, 500);
                rectangle(200, 400, 400, 500);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[6], key2);
                outtextxy(420, 420, CString(key2));
                save1(L1);
            }
            else if (mg.x > 600 && mg.x < 800 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(601, 401));
                clearrectangle(600, 400, 800, 500);
                rectangle(600, 400, 800, 500);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[7], key2);
                outtextxy(620, 420, CString(key2));
                save1(L1);
            }
            else if (mg.x > 800 && mg.x < 1000 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(401, 401));
                clearrectangle(800, 400, 1000, 500);
                rectangle(800, 400, 1000, 500);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[8], key2);
                outtextxy(820, 420, CString(key2));
                save1(L1);
            }
            else if (mg.x > 1000 && mg.x < 1200 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(1001, 401));
                clearrectangle(1000, 400, 1200, 500);
                rectangle(1000, 400, 1200, 500);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[9], key2);
                outtextxy(1020, 420, CString(key2));
                save1(L1);
            }
        }
        else if (mg.y > 500 && mg.y < 600)//第三行
        {
            if (mg.x > 200 && mg.x < 400 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(201, 501));
                clearrectangle(200, 500, 400, 600);
                rectangle(200, 500, 400, 600);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[10], key2);
                outtextxy(220, 520, CString(key2));
                save1(L1);
            }
            else if (mg.x > 400 && mg.x < 600 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(401, 501));
                clearrectangle(400, 500, 600, 600);
                rectangle(400, 500, 600, 600);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[11], key2);
                outtextxy(420, 520, CString(key2));
                save1(L1);
            }
            else if (mg.x > 600 && mg.x < 800 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(601, 501));
                clearrectangle(600, 500, 800, 600);
                rectangle(600, 500, 400, 800);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[12], key2);
                outtextxy(620, 520, CString(key2));
                save1(L1);
            }
            else if (mg.x > 800 && mg.x < 1000 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(801, 501));
                clearrectangle(800, 500, 1000, 600);
                rectangle(800, 500, 1000, 600);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[13], key2);
                outtextxy(820, 520, CString(key2));
                save1(L1);
            }
            else if (mg.x > 1000 && mg.x < 1200 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(1001, 501));
                clearrectangle(1000, 500, 1200, 600);
                rectangle(1000, 500, 1200, 600);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[14], key2);
                outtextxy(1020, 520, CString(key2));
                save1(L1);
            }
        }
        else if (mg.y > 600 && mg.y < 700)//第四行
        {
            if (mg.x > 200 && mg.x < 400 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(201, 601));
                clearrectangle(200, 600, 400, 700);
                rectangle(200, 600, 400, 700);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[15], key2);
                outtextxy(220, 620, CString(key2));
                save1(L1);
            }
            else if (mg.x > 400 && mg.x < 600 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(401, 601));
                clearrectangle(400, 600, 600, 700);
                rectangle(400, 600, 600, 700);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[16], key2);
                outtextxy(420, 620, CString(key2));
                save1(L1);
            }
            else if (mg.x > 600 && mg.x < 800 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(601, 601));
                clearrectangle(600, 600, 800, 700);
                rectangle(600, 600, 800, 700);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[17], key2);
                outtextxy(620, 620, CString(key2));
                save1(L1);
            }
            else if (mg.x > 800 && mg.x < 1000 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(801, 601));
                clearrectangle(800, 600, 1000, 700);
                rectangle(800, 600, 1000, 700);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[18], key2);
                outtextxy(820, 620, CString(key2));
                save1(L1);
            }
            else if (mg.x > 1000 && mg.x < 1200 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(1001, 601));
                clearrectangle(1000, 600, 1200, 700);
                rectangle(1000, 600, 1200, 700);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[19], key2);
                outtextxy(1020, 620, CString(key2));
                save1(L1);
            }
        }
        else if (mg.y > 700 && mg.y < 800)//第五行
        {

            if (mg.x > 200 && mg.x < 400 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(201, 701));
                clearrectangle(200, 700, 400, 800);
                rectangle(200, 700, 400, 799);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[20], key2);
                outtextxy(220, 720, CString(key2));
                save1(L1);
            }
            else if (mg.x > 400 && mg.x < 600 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(401, 701));
                clearrectangle(400, 700, 600, 800);
                rectangle(400, 700, 600, 799);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[21], key2);
                outtextxy(420, 720, CString(key2));
                save1(L1);
            }
            else if (mg.x > 600 && mg.x < 800 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(601, 701));
                clearrectangle(600, 700, 800, 800);
                rectangle(600, 700, 800, 799);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[22], key2);
                outtextxy(620, 720, CString(key2));
                save1(L1);
            }
            else if (mg.x > 800 && mg.x < 1000 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(801, 701));
                clearrectangle(800, 700, 1000, 800);
                rectangle(800, 700, 1000, 799);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[23], key2);
                outtextxy(820, 720, CString(key2));
                save1(L1);
            }
            else if (mg.x > 1000 && mg.x < 1200 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(1001, 701));
                clearrectangle(1000, 700, 1199, 800);
                rectangle(1000, 700, 1199, 799);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[24], key2);
                outtextxy(1020, 720, CString(key2));
                save1(L1);
            }
        }

    }
}
void Pstudent_chufen(student* stu)//處分資訊
{
    cleardevice();
    IMAGE pmain;//主介面圖片
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(360, 50, L"我的處分資訊");
    settextstyle(40, 20, L"微軟雅黑");
    rectangle(0, 0, 100, 50);
    outtextxy(5, 5, L"返回");
    //chufen* p = stu->Data.cfxinxi.next;
    for (int high = 100, i = 0; i < stu->Data.cfxinxi.loc; i++, high += 50)
    {
        if (*stu->Data.cfxinxi.name[i] != '\0')
            outtextxy(300, high, CString(stu->Data.cfxinxi.name[i]));
    }
    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            Pstudent(stu);
        }
    }
}
student* find_student(student* stu, List1* L)//建立在已經找到學生資訊的情況下,把該學生的位置傳出去
{
    student* p = L->head;
    while (p->next)
    {
        if (!strcmp(p->Data.ID, stu->Data.ID))
            return p;
        p = p->next;
    }
    return p;
}
student* find_stuID(List1* L, char* num)//尋找num學號的學生
{
    student* p = L->head;
    while (p)
    {
        if (!strcmp(p->Data.ID, num))
            return p;
        p = p->next;
    }
    return NULL;
}
View Code

這個cpp檔案裡面存放的就是上面對應的.h檔案的函式的定義(也就是函式的實現),(相當於自己寫一個庫?雖然比較小)

注意要把hstudent.h這個標頭檔案引用進去.

然後同理老師端的分檔案:

hteacher.h:

#pragma once
#include<cstdio>
#include"hstudent.h"
#include"hteacher.h"
#include"MAIN.h"
extern class List1* L1;//第一個學生
extern class List2* L2;//第一個老師
extern SYSTEMTIME st;
extern int X , Y ;//X:介面寬度 Y介面高度
extern int randnum;
extern HWND HD;
extern char qiandaoyuji[][50];
class data2//老師的資料
{
public:
    char ID[20];//賬號
    char mima[30];//密碼
    char name[30];//名字
};
class teacher
{
public:
    class data2 Data;
    class teacher* next;//指向下一個位置的指標
};
class List2//老師端,這樣更方便記錄資訊
{
public:
    class teacher* head;
};
void Pteacher(teacher* tea);
void Pteacher_GCJ(teacher* tea);
void Pteacher_GHJ(teacher* tea);
void Pteacher_KPM(teacher* tea);
void Pteacher_GMA(teacher* tea);
void Pteacher_CKQD(teacher* tea);
void Pteacherr_GCF(teacher* tea);
teacher* find_teacher(teacher* tea, List2* L);

hteacher.cpp:

#pragma once
#include<easyx.h>
#include<graphics.h>
#include<cstdio>
#include<iostream>
#include<windows.h>
#include<cstring>
#include<conio.h>
#include<vector>
#include<queue>
#include<algorithm>
#include <atlstr.h>
#include<ctime>
#include"hstudent.h"
#include"hteacher.h"
#include"MAIN.h"
#pragma comment(lib,"Winmm.lib")
using namespace std;

void Pteacher(teacher* tea)
{
    cleardevice();
    IMAGE pmain;//登入註冊介面
    IMAGE tx1, tx2;
    loadimage(&tx1, L"tx1.jpg", 200, 300);
    loadimage(&tx2, L"tx2.jpg", 200, 300);
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    putimage(1000, 0, &tx1);
    setbkmode(TRANSPARENT);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(370, 100, L"西柚資訊管理教師端");
    rectangle(1000, 0, 1200, 300);//頭像
    rectangle(500, 200, 800, 250);//修改學生成績
    rectangle(500, 300, 800, 350);//修改學生獲獎
    rectangle(500, 400, 800, 450);//檢視學生排名
    rectangle(500, 500, 800, 550);//檢視學生簽到
    rectangle(500, 600, 800, 650);//全校學生通知
    rectangle(500, 700, 800, 750);//修改學生處分
    rectangle(0, 0, 100, 50);

    settextstyle(40, 20, L"微軟雅黑");//選項資訊字型格式  
    outtextxy(5, 5, L"返回");//返回
    outtextxy(520, 205, L"修改學生成績");//修改學生成績
    outtextxy(520, 305, L"修改學生獲獎");//修改學生獲獎
    outtextxy(520, 405, L"檢視學生排名");//檢視學生排名
    outtextxy(520, 505, L"檢視學生簽到");//檢視學生簽到
    outtextxy(520, 605, L"修改學生密碼");//全校學生通知
    outtextxy(520, 705, L"修改學生處分");//修改學生處分
    outtextxy(100, 100, CString(tea->Data.name));
    settextstyle(30, 15, L"微軟雅黑");//
    rectangle(1100, 750, 1199, 799);//退出程式框
    outtextxy(1120, 760, L"退出");//退出程式

    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 500 && mg.x < 800)
        {
            if (mg.y > 200 && mg.y < 250 && mg.uMsg == WM_LBUTTONUP)//修改學生成績的範圍
            {
                Pteacher_GCJ(tea);
            }
            else if (mg.y > 300 && mg.y < 350 && mg.uMsg == WM_LBUTTONUP)//修改學生獲獎的範圍
            {
                Pteacher_GHJ(tea);
            }
            else if (mg.y > 400 && mg.y < 450 && mg.uMsg == WM_LBUTTONUP)//檢視學生排名的範圍
            {
                Pteacher_KPM(tea);
            }
            else if (mg.y > 500 && mg.y < 550 && mg.uMsg == WM_LBUTTONUP)//檢視學生簽到的範圍
            {
                Pteacher_CKQD(tea);
            }
            else if (mg.y > 600 && mg.y < 650 && mg.uMsg == WM_LBUTTONUP)//全校學生通知的範圍
            {
                Pteacher_GMA(tea);
            }
            else if (mg.y > 700 && mg.y < 750 && mg.uMsg == WM_LBUTTONUP)//修改學生處分的範圍
            {
                Pteacherr_GCF(tea);
            }
        }
        else if (mg.x > 1100 && mg.x < 1200 && mg.y > 750 && mg.y < 800 && mg.uMsg == WM_LBUTTONUP)
        {
            save1(L1);
            save2(L2);
            exit(0);
        }
        else if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            PMAIN();
        }
    }
}
void Pteacher_GCJ(teacher* tea)
{
    cleardevice();
    IMAGE pmain;//主介面圖片
    wchar_t xuehao[25];//讀取輸入資訊
    char xuehao2[25];//
    wchar_t key1[10];
    char key2[10];
    student* temp = NULL;
    ::memset(xuehao, 0, sizeof(xuehao));
    ::memset(xuehao2, 0, sizeof(xuehao2));
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    rectangle(550, 200, 880, 250);//學生學號輸入視窗
    rectangle(920, 200, 1020, 250);
    for (int i = 400; i < 700; i += 100)
    {
        rectangle(450, i, 550, i + 50);
    }
    for (int i = 400; i < 700; i += 100)
    {
        rectangle(850, i, 950, i + 50);
    }


    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(360, 50, L"修改學生成績");

    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(350, 200, L"學生學號:");
    outtextxy(350, 300, L"學生資訊:");
    outtextxy(300, 400, L"語文:");
    outtextxy(300, 500, L"數學:");
    outtextxy(300, 600, L"英語:");
    outtextxy(700, 400, L"物理:");
    outtextxy(700, 500, L"化學:");
    outtextxy(700, 600, L"C語言:");
    outtextxy(930, 205, L"確定");
    rectangle(0, 0, 100, 50);
    outtextxy(5, 5, L"返回");

    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            Pteacher(tea);
        }
        else if (mg.y > 200 && mg.y < 250)
        {
            if (mg.x > 550 && mg.x < 880 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(601, 201));
                clearrectangle(550, 200, 880, 250);
                rectangle(550, 200, 880, 250);
                InputBox(xuehao, 13, L"請輸入正確的學生學號哦(* ̄3 ̄)╭");
                WideCharToMultiByte(CP_ACP, 0, xuehao, -1, xuehao2, wcslen(xuehao) * 2 + 1, NULL, NULL);
                outtextxy(560, 210, xuehao);
            }
            else if (mg.x > 920 && mg.x < 1020 && mg.uMsg == WM_LBUTTONUP)
            {

                if (*xuehao2 != '\0')
                {
                    temp = find_stuID(L1, xuehao2);
                    if (temp)
                    {
                        char fenshu[15];
                        for (int i = 400; i < 700; i += 100)
                        {
                            setbkcolor(getpixel(451, i + 1));
                            clearrectangle(450, i, 550, i + 50);
                            rectangle(450, i, 550, i + 50);
                        }
                        for (int i = 400; i < 700; i += 100)
                        {
                            setbkcolor(getpixel(851, i + 1));
                            clearrectangle(850, i, 950, i + 50);
                            rectangle(850, i, 950, i + 50);
                        }
                        outtextxy(560, 305, CString(temp->Data.name));
                        ::sprintf(fenshu, "%d", temp->Data.all_kemu.yuwen);
                        outtextxy(460, 405, CString(fenshu));
                        ::sprintf(fenshu, "%d", temp->Data.all_kemu.shuxue);
                        outtextxy(460, 505, CString(fenshu));
                        ::sprintf(fenshu, "%d", temp->Data.all_kemu.yingyu);
                        outtextxy(460, 605, CString(fenshu));
                        ::sprintf(fenshu, "%d", temp->Data.all_kemu.wuli);
                        outtextxy(860, 405, CString(fenshu));
                        ::sprintf(fenshu, "%d", temp->Data.all_kemu.huaxue);
                        outtextxy(860, 505, CString(fenshu));
                        ::sprintf(fenshu, "%d", temp->Data.all_kemu.Cyuyan);
                        outtextxy(860, 605, CString(fenshu));
                        save1(L1);
                    }
                    else
                    {
                        MessageBox(HD, L"沒有該學生的資訊\n請檢查學號是否正確(>﹏<)", L"查詢學生資訊", MB_OK);
                    }
                }
                else
                {
                    MessageBox(HD, L"沒有該學生的資訊\n請檢查學號是否正確(>﹏<)", L"查詢學生資訊", MB_OK);
                }
            }
        }
        else if (mg.x > 450 && mg.x < 550 && mg.y>400 && mg.y < 450 && mg.uMsg == WM_LBUTTONUP)//語文成績
        {
            if (*xuehao2)
            {
                if (temp)
                {
                    setbkcolor(getpixel(451, 401));
                    clearrectangle(450, 400, 550, 450);
                    rectangle(450, 400, 550, 450);
                    InputBox(key1, 4, L"請輸入學生語文成績 ヾ(´∀`o)+");
                    WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                    outtextxy(460, 405, key1);
                    temp->Data.all_kemu.score += atoi(key2) - temp->Data.all_kemu.yuwen;
                    temp->Data.all_kemu.yuwen = atoi(key2);

                    save1(L1);
                }
                else
                    MessageBox(HD, L"沒有該學生的資訊\n請檢查學號是否正確(>﹏<)", L"查詢學生資訊", MB_OK);
            }
            else
                MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.x > 450 && mg.x < 550 && mg.y>500 && mg.y < 550 && mg.uMsg == WM_LBUTTONUP)//數學成績
        {
            if (*xuehao2)
            {
                if (temp)
                {
                    setbkcolor(getpixel(451, 551));
                    clearrectangle(450, 500, 550, 550);
                    rectangle(450, 500, 550, 550);
                    InputBox(key1, 4, L"請輸入學生數學成績 ヾ(´∀`o)+");
                    WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                    outtextxy(460, 505, key1);
                    temp->Data.all_kemu.score += atoi(key2) - temp->Data.all_kemu.shuxue;
                    temp->Data.all_kemu.shuxue = atoi(key2);
                    save1(L1);
                }
                else
                    MessageBox(HD, L"沒有該學生的資訊\n請檢查學號是否正確(>﹏<)", L"查詢學生資訊", MB_OK);
            }
            else
                MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.x > 450 && mg.x < 550 && mg.y>600 && mg.y < 650 && mg.uMsg == WM_LBUTTONUP)//英語成績
        {
            if (*xuehao2)
            {
                if (temp)
                {
                    setbkcolor(getpixel(451, 601));
                    clearrectangle(450, 600, 550, 650);
                    rectangle(450, 600, 550, 650);
                    InputBox(key1, 4, L"請輸入學生英語成績 ヾ(´∀`o)+");
                    WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                    outtextxy(460, 605, key1);
                    temp->Data.all_kemu.score += atoi(key2) - temp->Data.all_kemu.yingyu;
                    temp->Data.all_kemu.yingyu = atoi(key2);
                    save1(L1);
                }
                else
                {
                    MessageBox(HD, L"沒有該學生的資訊\n請檢查學號是否正確(>﹏<)", L"查詢學生資訊", MB_OK);
                }
            }
            else
                MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.x > 850 && mg.x < 950 && mg.y>400 && mg.y < 450 && mg.uMsg == WM_LBUTTONUP)//物理成績
        {
            if (*xuehao2)
            {
                if (temp)
                {
                    setbkcolor(getpixel(851, 401));
                    clearrectangle(850, 400, 950, 450);
                    rectangle(850, 400, 950, 450);
                    InputBox(key1, 4, L"請輸入學生物理成績 ヾ(´∀`o)+");
                    WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                    outtextxy(860, 405, key1);
                    temp->Data.all_kemu.score += atoi(key2) - temp->Data.all_kemu.wuli;
                    temp->Data.all_kemu.wuli = atoi(key2);
                    save1(L1);
                }
                else
                    MessageBox(HD, L"沒有該學生的資訊\n請檢查學號是否正確(>﹏<)", L"查詢學生資訊", MB_OK);
            }
            else
                MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.x > 850 && mg.x < 950 && mg.y>500 && mg.y < 550 && mg.uMsg == WM_LBUTTONUP)//化學成績
        {
            if (*xuehao2)
            {
                if (temp)
                {
                    setbkcolor(getpixel(851, 501));
                    clearrectangle(850, 500, 950, 550);
                    rectangle(850, 500, 950, 550);
                    InputBox(key1, 4, L"請輸入學生成績 ヾ(´∀`o)+");
                    WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                    outtextxy(860, 505, key1);
                    temp->Data.all_kemu.score += atoi(key2) - temp->Data.all_kemu.huaxue;
                    temp->Data.all_kemu.huaxue = atoi(key2);
                    save1(L1);
                }
                else
                    MessageBox(HD, L"沒有該學生的資訊\n請檢查學號是否正確(>﹏<)", L"查詢學生資訊", MB_OK);
            }
            else
                MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.x > 850 && mg.x < 950 && mg.y>600 && mg.y < 650 && mg.uMsg == WM_LBUTTONUP)//C語言成績
        {
            if (*xuehao2)
            {
                if (temp)
                {
                    setbkcolor(getpixel(851, 601));
                    clearrectangle(850, 600, 950, 650);
                    rectangle(850, 600, 950, 650);
                    InputBox(key1, 4, L"請輸入學生C語言成績 ヾ(´∀`o)+");
                    WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                    outtextxy(860, 605, key1);
                    temp->Data.all_kemu.score += atoi(key2) - temp->Data.all_kemu.Cyuyan;
                    temp->Data.all_kemu.Cyuyan = atoi(key2);
                    save1(L1);
                }
                else
                    MessageBox(HD, L"沒有該學生的資訊\n請檢查學號是否正確(>﹏<)", L"查詢學生資訊", MB_OK);
            }
            else
                MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
    }
}
void Pteacher_GHJ(teacher* tea)
{
    cleardevice();
    IMAGE pmain;//主介面圖片
    wchar_t xuehao[25];//讀取輸入資訊
    char xuehao2[25];//
    wchar_t key1[100];
    char key2[100];
    student* temp = NULL;
    ::memset(xuehao, 0, sizeof(xuehao));
    ::memset(xuehao2, 0, sizeof(xuehao2));
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    rectangle(550, 120, 880, 170);//學生學號輸入視窗
    rectangle(920, 120, 1020, 170);
    rectangle(0, 0, 100, 50);
    rectangle(500, 300, 950, 350);//1
    rectangle(500, 400, 950, 450);//2
    rectangle(500, 500, 950, 550);//3
    rectangle(500, 600, 950, 650);//4
    rectangle(500, 700, 950, 750);//5
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(360, 40, L"修改學生獲獎");

    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(350, 120, L"學生學號:");
    outtextxy(350, 200, L"學生資訊:");
    outtextxy(930, 125, L"確定");
    for (int i = 300; i <= 700; i += 100)
    {
        outtextxy(300, i, L"獲獎資訊:");
    }
    outtextxy(5, 5, L"返回");

    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            Pteacher(tea);
        }
        else if (mg.x > 550 && mg.x < 880 && mg.y>120 && mg.y < 170 && mg.uMsg == WM_LBUTTONUP)//學號輸入框
        {
            setbkcolor(getpixel(601, 201));
            clearrectangle(550, 120, 880, 170);
            rectangle(550, 120, 880, 170);
            InputBox(xuehao, 13, L"請輸入正確的學生學號哦(* ̄3 ̄)╭");
            WideCharToMultiByte(CP_ACP, 0, xuehao, -1, xuehao2, wcslen(xuehao) * 2 + 1, NULL, NULL);
            outtextxy(560, 130, xuehao);
        }
        else if (mg.y > 120 && mg.y < 170 && mg.x > 920 && mg.x < 1020 && mg.uMsg == WM_LBUTTONUP)//確認按鈕
        {
            if (*xuehao2 != '\0')
            {
                temp = find_stuID(L1, xuehao2);
                if (temp)
                {
                    outtextxy(550, 200, CString(temp->Data.name));
                    for (int i = 0, j = 305; i < 5; ++i, j += 100)
                    {
                        outtextxy(510, j, CString(temp->Data.hjxinxi.name[i]));
                    }
                }
                else
                {
                    MessageBox(HD, L"沒有該學生的資訊\n請檢查學號是否正確(>﹏<)", L"查詢學生資訊", MB_OK);
                }
            }
            else
                MessageBox(HD, L"沒有該學生的資訊\n請檢查學號是否正確(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.y > 300 && mg.y < 350 && mg.x > 500 && mg.x < 950 && mg.uMsg == WM_LBUTTONUP)//1
        {
            if (temp)
            {
                setbkcolor(getpixel(501, 301));
                clearrectangle(500, 300, 950, 350);
                rectangle(500, 300, 950, 350);
                InputBox(key1, 20, L"請輸入學生獲獎情況");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                outtextxy(505, 305, key1);
                strcpy(temp->Data.hjxinxi.name[0], key2);
                temp->Data.hjxinxi.loc = 1;
                save1(L1);
            }
            else
            {
                MessageBox(HD, L"請先輸入正確學生學號(>﹏<)", L"查詢學生資訊", MB_OK);
            }
        }
        else if (mg.y > 400 && mg.y < 450 && mg.x > 500 && mg.x < 950 && mg.uMsg == WM_LBUTTONUP)//2
        {
            if (temp)
            {
                setbkcolor(getpixel(501, 401));
                clearrectangle(500, 400, 950, 450);
                rectangle(500, 400, 950, 450);
                InputBox(key1, 20, L"請輸入學生獲獎情況");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                outtextxy(505, 405, key1);
                strcpy(temp->Data.hjxinxi.name[1], key2);
                temp->Data.hjxinxi.loc = 2;
                save1(L1);
            }
            else
                MessageBox(HD, L"請先輸入正確學生學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.y > 500 && mg.y < 550 && mg.x > 500 && mg.x < 950 && mg.uMsg == WM_LBUTTONUP)//3
        {
            if (temp)
            {
                setbkcolor(getpixel(501, 501));
                clearrectangle(500, 500, 950, 550);
                rectangle(500, 500, 950, 550);
                InputBox(key1, 20, L"請輸入學生獲獎情況");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                outtextxy(505, 505, key1);
                strcpy(temp->Data.hjxinxi.name[2], key2);
                temp->Data.hjxinxi.loc = 3;
                save1(L1);
            }
            else
                MessageBox(HD, L"請先輸入正確學生學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.y > 600 && mg.y < 650 && mg.x > 500 && mg.x < 950 && mg.uMsg == WM_LBUTTONUP)//4
        {
            if (temp)
            {
                setbkcolor(getpixel(501, 601));
                clearrectangle(500, 600, 950, 650);
                rectangle(500, 600, 950, 650);
                InputBox(key1, 20, L"請輸入學生獲獎情況");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                outtextxy(505, 605, key1);
                strcpy(temp->Data.hjxinxi.name[3], key2);
                temp->Data.hjxinxi.loc = 4;
                save1(L1);
            }
            else
                MessageBox(HD, L"請先輸入正確學生學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.y > 700 && mg.y < 750 && mg.x > 500 && mg.x < 950 && mg.uMsg == WM_LBUTTONUP)//5
        {
            if (temp)
            {
                setbkcolor(getpixel(501, 701));
                clearrectangle(500, 700, 950, 750);
                rectangle(500, 700, 950, 750);
                InputBox(key1, 20, L"請輸入學生獲獎情況");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                outtextxy(505, 705, key1);
                strcpy(temp->Data.hjxinxi.name[4], key2);
                temp->Data.hjxinxi.loc = 5;
                save1(L1);
            }
            else
                MessageBox(HD, L"請先輸入正確學生學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
    }
}
void Pteacher_KPM(teacher* tea)
{
    cleardevice();
    IMAGE pmain;//主介面圖片
    priority_queue<pair<int, const char*> >q;
    student* p = L1->head;
    for (; p; p = p->next)
    {
        q.push({ p->Data.all_kemu.score,p->Data.name });
    }
    wchar_t xuehao[25];//讀取輸入資訊
    char xuehao2[25];//
    char key2[100];
    student* temp = NULL;
    ::memset(xuehao, 0, sizeof(xuehao));
    ::memset(xuehao2, 0, sizeof(xuehao2));
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    rectangle(800, 150, 1199, 200);//學生學號輸入視窗
    rectangle(1100, 200, 1199, 250);//確認按鈕
    rectangle(0, 0, 100, 50);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(400, 40, L"檢視學生排名");


    settextcolor(GREEN);
    outtextxy(200, 100, L"前五名學生");
    settextcolor(WHITE);
    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(5, 5, L"返回");
    outtextxy(800, 100, L"查詢學生排名");
    outtextxy(680, 150, L"學號:");
    outtextxy(1110, 210, L"確定");
    outtextxy(680, 300, L"學生資訊:");

    outtextxy(680, 400, L"語文排名  :");
    outtextxy(680, 450, L"數學排名  :");
    outtextxy(680, 500, L"英語排名  :");
    outtextxy(680, 550, L"物理排名  :");
    outtextxy(680, 600, L"化學排名  :");
    outtextxy(680, 650, L"C語言排名:");
    outtextxy(680, 700, L"總分排名  :");


    for (int i = 0, j = 200; i < 5 && q.size(); ++i, j += 100, q.pop())
    {
        sprintf(key2, "%d", q.top().first);
        outtextxy(200, j, CString(key2));
        outtextxy(300, j, CString(q.top().second));
    }
    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            Pteacher(tea);
        }
        else if (mg.x > 800 && mg.x < 1200 && mg.y>150 && mg.y < 200 && mg.uMsg == WM_LBUTTONUP)
        {
            setbkcolor(getpixel(801, 151));
            clearrectangle(800, 150, 1200, 200);
            rectangle(800, 150, 1200, 200);
            InputBox(xuehao, 13, L"請輸入正確的學生學號哦(* ̄3 ̄)╭");
            WideCharToMultiByte(CP_ACP, 0, xuehao, -1, xuehao2, wcslen(xuehao) * 2 + 1, NULL, NULL);
            outtextxy(810, 160, xuehao);
        }
        else if (mg.x > 1100 && mg.x < 1200 && mg.y>200 && mg.y < 250 && mg.uMsg == WM_LBUTTONUP)
        {
            if (*xuehao2)
            {
                temp = find_stuID(L1, xuehao2);
                if (temp)
                {
                    setbkcolor(getpixel(801, 151));
                    clearrectangle(890, 290, 1100, 350);
                    outtextxy(900, 300, CString(temp->Data.name));
                    char ch[10];
                    memset(ch, 0, sizeof(ch));
                    int rank[7] = { 1,1,1,1,1,1,1 };
                    for (p = L1->head; p != NULL; p = p->next)
                    {
                        if (strcmp(temp->Data.ID, p->Data.ID))
                        {
                            if (temp->Data.all_kemu.yuwen < p->Data.all_kemu.yuwen)
                                rank[0]++;
                            if (temp->Data.all_kemu.shuxue < p->Data.all_kemu.shuxue)
                                rank[1]++;
                            if (temp->Data.all_kemu.yingyu < p->Data.all_kemu.huaxue)
                                rank[2]++;
                            if (temp->Data.all_kemu.wuli < p->Data.all_kemu.wuli)
                                rank[3]++;
                            if (temp->Data.all_kemu.huaxue < p->Data.all_kemu.huaxue)
                                rank[4]++;
                            if (temp->Data.all_kemu.Cyuyan < p->Data.all_kemu.Cyuyan)
                                rank[5]++;
                            if (temp->Data.all_kemu.score < p->Data.all_kemu.score)
                                rank[6]++;
                        }
                    }
                    for (int i = 410, j = 0; j < 7; i += 50, ++j)
                    {
                        ::sprintf(ch, "%d", rank[j]);
                        setbkcolor(getpixel(901, i));
                        clearrectangle(900, i - 10, 1000, i + 50);
                        outtextxy(910, i, CString(ch));
                    }
                }
                else
                {
                    MessageBox(HD, L"未找到該學生資訊=_=", L"學號輸入資訊", MB_OK);
                }
            }
            else
            {
                MessageBox(HD, L"請先輸入學號=_=", L"學號輸入資訊", MB_OK);
            }
        }
    }
}
void Pteacher_GMA(teacher* tea)
{
    cleardevice();
    IMAGE pmain;//背景圖
    student* stu = NULL;
    wchar_t xuehao1[25];
    char xuehao2[25];
    wchar_t mima1[25];
    char mima2[25];
    memset(mima1, 0, sizeof(mima1));
    memset(mima2, 0, sizeof(mima2));
    memset(xuehao1, 0, sizeof(xuehao1));
    memset(xuehao2, 0, sizeof(xuehao2));
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(400, 200, L"學生密碼修改");
    rectangle(0, 0, 100, 50);
    rectangle(900, 350, 1000, 400);//確定
    rectangle(500, 350, 900, 400);
    rectangle(500, 450, 900, 500);
    rectangle(500, 550, 900, 600);
    rectangle(500, 650, 900, 700);
    rectangle(650, 750, 850, 799);
    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(5, 5, L"返回");
    outtextxy(200, 350, L"學號:");
    outtextxy(200, 450, L"學生資訊:");
    outtextxy(200, 550, L"原密碼:");
    outtextxy(200, 650, L"新密碼:");
    outtextxy(910, 355, L"確定");
    outtextxy(660, 755, L"確定修改");

    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            Pteacher(tea);
        }
        else if (mg.x > 500 && mg.x < 900 && mg.y>350 && mg.y < 400 && mg.uMsg == WM_LBUTTONUP)//學號輸入
        {
            setbkcolor(getpixel(501, 351));
            clearrectangle(500, 350, 900, 400);
            rectangle(500, 350, 900, 400);
            InputBox(xuehao1, 13, L"請輸入學號");
            WideCharToMultiByte(CP_ACP, 0, xuehao1, -1, xuehao2, wcslen(xuehao1) * 2 + 1, NULL, NULL);
            outtextxy(510, 355, xuehao1);
        }
        else if (mg.x > 900 && mg.x < 1000 && mg.y>350 && mg.y < 400 && mg.uMsg == WM_LBUTTONUP)//確定按鈕
        {
            if (*xuehao2)
            {
                stu = find_stuID(L1, xuehao2);
                if (stu)
                {
                    setbkcolor(getpixel(501, 451));
                    clearrectangle(500, 450, 900, 500);
                    rectangle(500, 450, 900, 500);
                    outtextxy(510, 455, CString(stu->Data.name));
                    setbkcolor(getpixel(501, 551));
                    clearrectangle(500, 550, 900, 600);
                    rectangle(500, 550, 900, 600);
                    outtextxy(510, 555, CString(stu->Data.mima));
                }
                else
                {
                    MessageBox(HD, L"沒有該學生資訊哦", L"學生資訊", MB_OK);
                }
            }
            else
            {
                MessageBox(HD, L"請先輸入學生學號", L"學生資訊", MB_OK);
            }
        }
        else if (mg.x > 500 && mg.x < 900 && mg.y>650 && mg.y < 700 && mg.uMsg == WM_LBUTTONUP)//新密碼輸入框
        {
            if (*xuehao2)
            {
                if (stu)
                {
                    setbkcolor(getpixel(501, 651));
                    clearrectangle(500, 650, 900, 700);
                    rectangle(500, 650, 900, 700);
                    InputBox(mima1, 13, L"請輸入新密碼");
                    WideCharToMultiByte(CP_ACP, 0, mima1, -1, mima2, wcslen(mima1) * 2 + 1, NULL, NULL);
                    outtextxy(510, 655, mima1);
                }
                else
                {
                    MessageBox(HD, L"沒有該學生資訊哦", L"學生資訊", MB_OK);
                }
            }
            else
            {
                MessageBox(HD, L"請先輸入學生學號", L"學生資訊", MB_OK);
            }
        }
        else if (mg.x > 650 && mg.x < 750 && mg.y>750 && mg.y < 799 && mg.uMsg == WM_LBUTTONUP)//確當修改框
        {
            if (*xuehao2)
            {
                if (stu)
                {
                    strcpy_s(stu->Data.mima, mima2);
                    save1(L1);
                    MessageBox(HD, L"學生密碼修改成功", L"學生資訊", MB_OK);
                }
                else
                {
                    MessageBox(HD, L"沒有該學生資訊哦", L"學生資訊", MB_OK);
                }
            }
            else
            {
                MessageBox(HD, L"請先輸入學生學號", L"學生資訊", MB_OK);
            }
        }
    }
}
void Pteacher_CKQD(teacher* tea)
{
    cleardevice();
    IMAGE pmain;//主介面圖片
    wchar_t xuehao[25];//讀取輸入資訊
    char xuehao2[25];//
    student* temp = NULL;
    ::memset(xuehao, 0, sizeof(xuehao));
    ::memset(xuehao2, 0, sizeof(xuehao2));
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    rectangle(550, 120, 870, 170);//學生學號輸入視窗
    rectangle(870, 120, 970, 170);
    rectangle(0, 0, 100, 50);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(360, 40, L"檢視學生簽到情況");

    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(350, 120, L"學生學號:");
    outtextxy(350, 200, L"學生資訊:");
    outtextxy(880, 125, L"確定");
    outtextxy(5, 5, L"返回");
    int tol_renshu = 0, tol_qiandaoshu = 0;//tol_renshu是總人數,tol_qiandaoshu是簽到的人數
    char tol_RS[10], tol_QDRS[10];
    student* p = L1->head;
    for (; p; p = p->next)
    {
        if (p->Data.qiandao)
            ++tol_qiandaoshu;
        ++tol_renshu;
    }
    ::sprintf(tol_RS, "%d", tol_renshu);
    ::sprintf(tol_QDRS, "%d", tol_qiandaoshu);
    outtextxy(100, 300, L"學生總人數:");
    outtextxy(100, 400, L"簽到的學生數目:");
    outtextxy(450, 300, CString(tol_RS));
    outtextxy(450, 400, CString(tol_QDRS));
    outtextxy(600, 300, L"未簽到學生:");
    outtextxy(850, 200, L"簽到情況:");

    p = L1->head;
    for (int j = 350, i = 600; p; p = p->next)
    {
        if (j > 800)
        {
            j = 350;
            i += 200;
        }
        if (!p->Data.qiandao)
        {
            settextcolor(RED);
            outtextxy(i, j, CString(p->Data.name));//輸出未簽到的名字
            j += 50;
            settextcolor(WHITE);
        }
    }
    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            Pteacher(tea);
        }
        else if (mg.x > 550 && mg.x < 870 && mg.y>120 && mg.y < 170 && mg.uMsg == WM_LBUTTONUP)
        {
            setbkcolor(getpixel(551, 121));
            clearrectangle(550, 120, 870, 170);
            rectangle(550, 120, 870, 170);
            InputBox(xuehao, 13, L"請輸入正確的學生學號哦(* ̄3 ̄)╭");
            WideCharToMultiByte(CP_ACP, 0, xuehao, -1, xuehao2, wcslen(xuehao) * 2 + 1, NULL, NULL);
            outtextxy(560, 130, xuehao);
        }
        else if (mg.x > 850 && mg.x < 970 && mg.y>120 && mg.y < 170 && mg.uMsg == WM_LBUTTONUP)
        {
            if (*xuehao2)
            {
                temp = find_stuID(L1, xuehao2);
                if (temp)
                {
                    if (temp->Data.qiandao)
                    {
                        setbkcolor(getpixel(601, 201));
                        clearrectangle(540, 200, 750, 240);
                        outtextxy(550, 200, CString(temp->Data.name));
                        setbkcolor(getpixel(1051, 201));
                        clearrectangle(1040, 200, 1199, 240);
                        settextcolor(GREEN);
                        outtextxy(1050, 200, L"已簽到");
                        settextcolor(WHITE);
                    }
                    else
                    {
                        setbkcolor(getpixel(601, 201));
                        clearrectangle(540, 200, 750, 240);
                        outtextxy(550, 200, CString(temp->Data.name));
                        setbkcolor(getpixel(1051, 201));
                        clearrectangle(1040, 200, 1199, 240);
                        settextcolor(RED);
                        outtextxy(1050, 200, L"未簽到");
                        settextcolor(WHITE);
                    }
                }
                else
                {
                    MessageBox(HD, L"未找到該學生資訊=_=", L"學號輸入資訊", MB_OK);
                }
            }
            else
            {
                MessageBox(HD, L"請先輸入學號=_=", L"學號輸入資訊", MB_OK);
            }
        }

    }
}
void Pteacherr_GCF(teacher* tea)
{
    cleardevice();
    IMAGE pmain;//主介面圖片
    wchar_t xuehao[25];//讀取輸入資訊
    char xuehao2[25];//
    wchar_t key1[100];
    char key2[100];
    student* temp = NULL;
    ::memset(xuehao, 0, sizeof(xuehao));
    ::memset(xuehao2, 0, sizeof(xuehao2));
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    rectangle(550, 120, 870, 170);//學生學號輸入視窗
    rectangle(920, 120, 1020, 170);
    rectangle(0, 0, 100, 50);
    rectangle(500, 300, 950, 350);//1
    rectangle(500, 400, 950, 450);//2
    rectangle(500, 500, 950, 550);//3
    rectangle(500, 600, 950, 650);//4
    rectangle(500, 700, 950, 750);//5
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(360, 40, L"修改學生處分");

    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(350, 120, L"學生學號:");
    outtextxy(350, 200, L"學生資訊:");
    outtextxy(930, 125, L"確定");
    for (int i = 300; i <= 700; i += 100)
    {
        outtextxy(300, i, L"處分資訊:");
    }
    outtextxy(5, 5, L"返回");

    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            Pteacher(tea);
        }
        else if (mg.x > 550 && mg.x < 870 && mg.y>120 && mg.y < 170 && mg.uMsg == WM_LBUTTONUP)//學號輸入框
        {
            setbkcolor(getpixel(601, 201));
            clearrectangle(550, 120, 870, 170);
            rectangle(550, 120, 870, 170);
            InputBox(xuehao, 13, L"請輸入正確的學生學號哦(* ̄3 ̄)╭");
            WideCharToMultiByte(CP_ACP, 0, xuehao, -1, xuehao2, wcslen(xuehao) * 2 + 1, NULL, NULL);
            outtextxy(560, 130, xuehao);
        }
        else if (mg.y > 120 && mg.y < 170 && mg.x > 920 && mg.x < 1020 && mg.uMsg == WM_LBUTTONUP)//確認按鈕
        {
            if (*xuehao2 != '\0')
            {
                temp = find_stuID(L1, xuehao2);
                if (temp)
                {
                    outtextxy(550, 200, CString(temp->Data.name));
                    for (int i = 0, j = 305; i < 5; ++i, j += 100)
                    {
                        outtextxy(510, j, CString(temp->Data.cfxinxi.name[i]));
                    }
                }
                else
                    MessageBox(HD, L"未找到該學號=_=", L"查詢學生資訊", MB_OK);
            }
            else
                MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.y > 300 && mg.y < 350 && mg.x > 500 && mg.x < 950 && mg.uMsg == WM_LBUTTONUP)//1
        {
            if (*xuehao2)
            {
                if (temp)
                {
                    setbkcolor(getpixel(501, 301));
                    clearrectangle(500, 300, 950, 350);
                    rectangle(500, 300, 950, 350);
                    InputBox(key1, 20, L"請輸入學生處分資訊");
                    WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                    outtextxy(505, 305, key1);
                    strcpy(temp->Data.cfxinxi.name[0], key2);
                    temp->Data.cfxinxi.loc = 1;
                    save1(L1);
                }
                else
                    MessageBox(HD, L"未找到該學號", L"查詢學生資訊", MB_OK);
            }
            else
                MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.y > 400 && mg.y < 450 && mg.x > 500 && mg.x < 950 && mg.uMsg == WM_LBUTTONUP)//2
        {
            if (*xuehao2)
            {
                if (temp)
                {
                    setbkcolor(getpixel(501, 401));
                    clearrectangle(500, 400, 950, 450);
                    rectangle(500, 400, 950, 450);
                    InputBox(key1, 20, L"請輸入學生處分資訊");
                    WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                    outtextxy(505, 405, key1);
                    strcpy(temp->Data.cfxinxi.name[1], key2);
                    temp->Data.cfxinxi.loc = 2;
                    save1(L1);
                }
                else
                    MessageBox(HD, L"未找到該學號=_=", L"查詢學生資訊", MB_OK);
            }
            else
                MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.y > 500 && mg.y < 550 && mg.x > 500 && mg.x < 950 && mg.uMsg == WM_LBUTTONUP)//3
        {
            if (*xuehao2)
            {
                if (temp)
                {
                    setbkcolor(getpixel(501, 501));
                    clearrectangle(500, 500, 950, 550);
                    rectangle(500, 500, 950, 550);
                    InputBox(key1, 20, L"請輸入學生處分資訊");
                    WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                    outtextxy(505, 505, key1);
                    strcpy(temp->Data.cfxinxi.name[2], key2);
                    temp->Data.cfxinxi.loc = 3;
                    save1(L1);
                }
                else
                    MessageBox(HD, L"未找到該學號=_=", L"查詢學生資訊", MB_OK);
            }
            else
                MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.y > 600 && mg.y < 650 && mg.x > 500 && mg.x < 950 && mg.uMsg == WM_LBUTTONUP)//4
        {
            if (*xuehao2)
            {
                if (temp)
                {
                    setbkcolor(getpixel(501, 601));
                    clearrectangle(500, 600, 950, 650);
                    rectangle(500, 600, 950, 650);
                    InputBox(key1, 20, L"請輸入學生處分資訊");
                    WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                    outtextxy(505, 605, key1);
                    strcpy(temp->Data.cfxinxi.name[3], key2);
                    temp->Data.cfxinxi.loc = 4;
                    save1(L1);
                }
                else
                    MessageBox(HD, L"未找到該學號=_=", L"查詢學生資訊", MB_OK);
            }
            else
                MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.y > 700 && mg.y < 750 && mg.x > 500 && mg.x < 950 && mg.uMsg == WM_LBUTTONUP)//5
        {
            if (xuehao2)
            {
                if (temp)
                {
                    setbkcolor(getpixel(501, 701));
                    clearrectangle(500, 700, 950, 750);
                    rectangle(500, 700, 950, 750);
                    InputBox(key1, 20, L"請輸入學生處分資訊");
                    WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                    outtextxy(505, 705, key1);
                    strcpy(temp->Data.cfxinxi.name[4], key2);
                    temp->Data.cfxinxi.loc = 5;
                    save1(L1);
                }
                else
                    MessageBox(HD, L"未找到該學號=_=", L"查詢學生資訊", MB_OK);
            }
            else
                MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
    }
}
teacher* find_teacher(teacher* tea, List2* L)//建立在已經找到老師資訊的情況下,把該老師的位置傳出去
{
    teacher* p = L->head;
    while (p->next)
    {
        if (!strcmp(p->Data.ID, tea->Data.ID))
            return p;
        p = p->next;
    }
    return p;
}
View Code

最後是主檔案裡面:

#include<easyx.h>
#include<graphics.h>
#include<cstdio>
#include<iostream>
#include<windows.h>
#include<cstring>
#include<conio.h>
#include<vector>
#include<queue>
#include<algorithm>
#include <atlstr.h>
#include<ctime>
#include"hstudent.h"
#include"hteacher.h"
#include"MAIN.h"
#pragma comment(lib,"Winmm.lib")
SYSTEMTIME st;//windows的API時間獲取
char qiandaoyuji[][50] = { "為成功找方法,不為失敗找藉口","理想的書籍是聰明的鑰匙","書猶藥也,善讀之可以醫愚。" ,"書籍乃世人積累智慧之長明燈。","好學而不勤問非真好學者。","聰明出於勤奮,天才在於積累","有志者事競成","成功源於努力","世上無難事","寶劍鋒自磨礪出","梅花香自苦寒來","天生我才必有用","一天過完,不會再來","行成於思,毀於隨","If winter comes , can spring be far behind ?","There is no royal road to science.","Genius only means hard-working all one's life.","Nothing is impossible!","Doubt is the key to knowledge.","Clumsy birds have to start flying early."};
using namespace std;
HWND HD;
int X=1200, Y=800;//X:介面寬度 Y介面高度
int randnum;
class List1* L1;//第一個學生
class List2* L2;//第一個老師
int main()
{
    GetLocalTime(&st);
    srand((int)time(NULL));
    randnum = rand();
    L1 = (List1*)malloc(sizeof(List1));
    L1->head = NULL;
    L2 = (List2*)malloc(sizeof(List2));
    L2->head = NULL;
    read(L1, L2);//讀取檔案
    initgraph(X, Y);
    HD=GetHWnd();
    mciSendString(_T("open bkmusic.mp3 alias music"), NULL, 0, NULL);
    mciSendString(_T("play music repeat"), NULL, 0, NULL);
    PMAIN();
    system("pause");
    return 0;
}

最後總結一下小技巧:

1.在我的學生端有個簽到功能,這個功能要做到實時更新,就必須有一個記錄時間的變數,我是直接解除安裝類裡面的

我們可以通過定義一個SYSTEMTIME(windows的一個API)的變數,在程式啟動的時候獲取年月日,然後記錄下來當簽到的時候比較一下就好了。

2.在使用檔案操作的時候儘量使用wb和rb的方式,以二進位制的方式開啟,這樣檔案儲存就不會存在亂碼的情況

3.輸出的時候出現屯屯屯,這是由於類/結構體的變數沒有初始化造成的,可以在每次聲明後memset一下(具體操作看上面的.cpp檔案)

4.easyx的更多操作請移步:傳送門

5.MessageBox作為互動其實挺好用的, 學習傳送門

最後附上由一個.cpp檔案寫成的原始碼:

#include<easyx.h>
#include<graphics.h>
#include<cstdio>
#include<iostream>
#include<windows.h>
#include<cstring>
#include<conio.h>
#include<vector>
#include<queue>
#include<algorithm>
#include <atlstr.h>
#include<ctime>
#pragma comment(lib,"Winmm.lib")
#define MOD 1000000005;
SYSTEMTIME st;//windows的API時間獲取
char qiandaoyuji[][50] = { "為成功找方法,不為失敗找藉口","理想的書籍是聰明的鑰匙","書猶藥也,善讀之可以醫愚。" ,"書籍乃世人積累智慧之長明燈。","好學而不勤問非真好學者。","聰明出於勤奮,天才在於積累","有志者事競成","成功源於努力","世上無難事","寶劍鋒自磨礪出","梅花香自苦寒來","天生我才必有用","一天過完,不會再來","行成於思,毀於隨","If winter comes , can spring be far behind ?","There is no royal road to science.","Genius only means hard-working all one's life.","Nothing is impossible!","Doubt is the key to knowledge.","Clumsy birds have to start flying early."};
using namespace std;
HWND HD;
int X=1200, Y=800;//X:介面寬度 Y介面高度
int randnum;
class subject
{
public:
    int yuwen;
    int shuxue;
    int yingyu;
    int wuli;
    int huaxue;
    int Cyuyan;
    int score;//總分
};
class huojiang
{
public:
    char name[10][100];
    int loc=0;
};
class chufen
{
public:
    char name[10][100];
    int loc=0;
};
class data1//學生的資料
{
public:
    char ID[20];//賬號
    char mima[30];//密碼
    char name[30];//名字
    char kebiao[25][10];//課表
    int qiandao=0;//是否簽到
    int lastqiandao;//上次簽到的時間
    huojiang hjxinxi;//獲獎資訊
    subject all_kemu;//科目資訊
    chufen    cfxinxi;//處分資訊
    
};
class data2//老師的資料
{
public:
    char ID[20];//賬號
    char mima[30];//密碼
    char name[30];//名字
};
class student
{
public:
    class data1 Data;
    class student* next;///指向下一個位置的指標    
};
class teacher
{
public:
    class data2 Data;
    class teacher* next;//指向下一個位置的指標
};
class List1//學生端
{
public:
    class student* head;
};
class List2//老師端,這樣更方便記錄資訊
{
public:
    class teacher* head;
};
class List1 *L1;//第一個學生
class List2 *L2;//第一個老師
List1* add_stu(class student* p, class List1* L);//學生資訊新增  名字,學號,初始化學生資訊
List2* add_tea(class teacher* p, class List2* L);//初始化老師資訊
int find_ID(class student* p1, class teacher* p2, class List1* L_1, class List2* L_2);
bool save1(List1* p1);
bool save2(List2* p2);
void read(class List1* p1, class List2* p2);
void Pregister();
void Plog();
void PMAIN();
student* find_stuID(List1* L, char* num);
void Pstudent(student* stu);//學生端介面
void Pstudent_qiandao(student* stu);//簽到
void Pstudent_chengji(student* stu);//學生成績
void Pstudent_paiming(student* stu);//排名功能
void Pstudent_huojiang(student* stu);//獲獎情況
void Pstudent_xuexi(student* stu);//學習資料
void Pstudent_kebiao(student* stu);//課表檢視
void Pstudent_chufen(student* stu);//處分資訊
void Pteacher(teacher* tea);
void Pteacher_GCJ(teacher* tea);
void Pteacher_GHJ(teacher* tea);
void Pteacher_KPM(teacher* tea);
void Pteacher_GMA(teacher* tea);
void Pteacher_CKQD(teacher* tea);
void Pteacherr_GCF(teacher* tea);
student* find_student(student* stu, List1* L);
teacher* find_teacher(teacher* tea, List2* L);
void add_huojiang(huojiang* hj, student* L);
int main()
{
    GetLocalTime(&st);
    srand((int)time(NULL));
    randnum = rand();
    L1 = (List1*)malloc(sizeof(List1));
    L1->head = NULL;
    L2 = (List2*)malloc(sizeof(List2));
    L2->head = NULL;
    read(L1, L2);//讀取檔案
    initgraph(X, Y);
    HD=GetHWnd();
    mciSendString(_T("open bkmusic.mp3 alias music"), NULL, 0, NULL);
    mciSendString(_T("play music repeat"), NULL, 0, NULL);
    PMAIN();
    system("pause");
    return 0;

}
void add_huojiang(huojiang* hj,student* L)//學生獲獎資訊新增 用於初始化
{

    for (int i = 0; i < hj->loc && L->Data.hjxinxi.loc < 10 && i < 10; ++i)
    {
        strcpy_s(L->Data.hjxinxi.name[L->Data.hjxinxi.loc++], hj->name[i]);
    }
    return ;
}
void add_chufen(chufen* cf, student* L)//新增學生處分資訊 用於初始化時
{
    
    for (int i = 0; i < cf->loc&&i<10&&L->Data.cfxinxi.loc<10; ++i)
    {
        strcpy_s(L->Data.cfxinxi.name[L->Data.cfxinxi.loc++], cf->name[i]);
    }
    return ;
}
List1* add_stu(student* p, List1* L)//學生資訊新增  名字,學號,初始化學生資訊
{
    student* temp = (student*)malloc(sizeof(student));
    ::memset(temp, 0, sizeof(temp));
    ::memset(temp->Data.cfxinxi.name, 0, sizeof(temp->Data.cfxinxi.name));
    ::memset(temp->Data.hjxinxi.name, 0, sizeof(temp->Data.hjxinxi.name));
    ::memset(&temp->Data.all_kemu, 0, sizeof(temp->Data.all_kemu));
    ::memset(temp->Data.kebiao, 0, sizeof(temp->Data.kebiao));
    temp->Data.cfxinxi.loc = 0;
    temp->Data.all_kemu.score = 0;
    temp->next = NULL;
    temp->Data.hjxinxi.loc = 0;//獲獎
    temp->Data.lastqiandao = p->Data.lastqiandao;//簽到資訊,每次登入都會重新置為0,別問為什麼,問就是不會實時更新。°(°¯᷄◠¯᷅°)°。
    GetLocalTime(&st);
    if (temp->Data.lastqiandao == (st.wYear * 365 + st.wMonth * 30 + st.wDay))
    {
        temp->Data.qiandao = 1;
    }
    else
    {
        temp->Data.qiandao = 0;
    }
    if (*p->Data.ID != '\0')
        strcpy_s(temp->Data.ID, (p->Data.ID));//拷貝學生ID
    if (*p->Data.name != '\0')
        strcpy_s(temp->Data.name, (p->Data.name));//拷貝學生名字
    if (*p->Data.mima != '\0')
        strcpy_s(temp->Data.mima, (p->Data.mima));//拷貝學生密碼
    if (p->Data.cfxinxi.loc)//拷貝處分資訊
    {
        add_chufen(&p->Data.cfxinxi, temp);
    }
    if (p->Data.hjxinxi.loc)//拷貝獲獎資訊
    {
        add_huojiang(&p->Data.hjxinxi, temp);
    }
    //成績錄入
    temp->Data.all_kemu.yuwen = p->Data.all_kemu.yuwen;
    temp->Data.all_kemu.shuxue = p->Data.all_kemu.shuxue;
    temp->Data.all_kemu.yingyu = p->Data.all_kemu.yingyu;
    temp->Data.all_kemu.wuli = p->Data.all_kemu.wuli;
    temp->Data.all_kemu.huaxue = p->Data.all_kemu.huaxue;
    temp->Data.all_kemu.Cyuyan = p->Data.all_kemu.Cyuyan;
    temp->Data.all_kemu.score = p->Data.all_kemu.score;//p->Data.all_kemu.yuwen + p->Data.all_kemu.shuxue + p->Data.all_kemu.yingyu + p->Data.all_kemu.wuli + p->Data.all_kemu.huaxue + p->Data.all_kemu.Cyuyan;
    
    //課表讀取
    for (int i = 0; i < 25; ++i)
    {
        strcpy_s(temp->Data.kebiao[i], p->Data.kebiao[i]);
    }
    student* pp = L->head;
    if (pp!=NULL)//如果已有多個學生資訊
    {
        while (pp->next)//找到指標末尾
            pp = pp->next;
        pp->next = temp;
    }
    else//如果為第一個學生
    {
        L->head = temp;
    }
    return L;
}
List2* add_tea( teacher* p,List2* L)//初始化老師資訊
{
        teacher* temp =(teacher*)malloc(sizeof(teacher));
        temp->next = NULL;
        if(*p->Data.ID!='\0')
        strcpy_s(temp->Data.ID, p->Data.ID);//拷貝ID
        if (*p->Data.mima != '\0')
        strcpy_s(temp->Data.mima, p->Data.mima);//拷貝密碼
        if (*p->Data.name != '\0')
        strcpy_s(temp->Data.name, p->Data.name);//拷貝名字
        teacher* pp = L->head;
    if (pp)
    {
        while (pp->next)
            pp = pp->next;
        pp->next = temp;
    }
    else
        L->head = temp;
    return L;
}
bool save1( List1* p1 )
{
    student* pp1;
    FILE* fp1 = NULL;
    fp1 = fopen("student.txt", "wb");
    for (pp1 = p1->head; pp1 != NULL; pp1 = pp1->next)
    {
        fwrite(pp1, sizeof(student), 1, fp1);
    }
    fclose(fp1);
    return true;
}
bool save2(List2* p2)
{
    teacher* pp2;
    FILE* fp2 = NULL;
    fp2= fopen("teacher.txt", "wb");
    if (fp2 == NULL)
    {
        printf("kk");
    }
    for (pp2 = p2->head; pp2 != NULL; pp2 = pp2->next)
    {
        fwrite(pp2,  sizeof(teacher),1, fp2);
    }
    fclose(fp2);
    return true;
}
void read( List1* p1,  List2* p2)
{
    student *s1=(student*)malloc(sizeof(student));
    teacher *s2=(teacher*)malloc(sizeof(student));
    chufen* cf1 = (chufen*)malloc(sizeof(chufen));
    ::memset(cf1->name, 0, sizeof(cf1->name));
    cf1->loc = 0;
    ::memset(s1->Data.cfxinxi.name, 0, sizeof(s1->Data.cfxinxi.name));
    s1->Data.cfxinxi.loc = 0;
    FILE* fp1 = NULL;
    FILE* fp2 = NULL;
    fp1=fopen("student.txt", "rb");
    if (fp1 == NULL)
    {
        fp1=fopen("student.txt", "wb");
        goto out1;
    }
    while(fread(s1, sizeof(student), 1, fp1)) 
    {
        L1 = add_stu(s1, p1);
    }
    out1:
    fclose(fp1);
    fp2=fopen("teacher.txt", "rb");
    if (fp2 == NULL)
    {
        fopen( "teacher.txt", "wb");
        return;
    }
    while(fread(s2, sizeof(teacher), 1, fp2)!=0)
    {
        L2=add_tea(s2, p2);
    }
    fclose(fp2);
}
void Pteacher(teacher *tea)
{
    cleardevice();
    IMAGE pmain;//登入註冊介面
    IMAGE tx1, tx2;
    loadimage(&tx1, L"tx1.jpg", 200, 300);
    loadimage(&tx2, L"tx2.jpg", 200, 300);
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    putimage(1000, 0, &tx1);
    setbkmode(TRANSPARENT);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(370, 100, L"西柚資訊管理教師端");
    rectangle(1000, 0, 1200, 300);//頭像
    rectangle(500, 200, 800, 250);//修改學生成績
    rectangle(500, 300, 800, 350);//修改學生獲獎
    rectangle(500, 400, 800, 450);//檢視學生排名
    rectangle(500, 500, 800, 550);//檢視學生簽到
    rectangle(500, 600, 800, 650);//全校學生通知
    rectangle(500, 700, 800, 750);//修改學生處分
    rectangle(0, 0, 100, 50);
    
    settextstyle(40, 20, L"微軟雅黑");//選項資訊字型格式  
    outtextxy(5, 5, L"返回");//返回
    outtextxy(520, 205, L"修改學生成績");//修改學生成績
    outtextxy(520, 305, L"修改學生獲獎");//修改學生獲獎
    outtextxy(520, 405, L"檢視學生排名");//檢視學生排名
    outtextxy(520, 505, L"檢視學生簽到");//檢視學生簽到
    outtextxy(520, 605, L"修改學生密碼");//全校學生通知
    outtextxy(520, 705, L"修改學生處分");//修改學生處分
    outtextxy(100, 100, CString(tea->Data.name));
    settextstyle(30, 15, L"微軟雅黑");//
    rectangle(1100, 750, 1199, 799);//退出程式框
    outtextxy(1120, 760, L"退出");//退出程式
    
    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 500 && mg.x < 800)
        {
            if (mg.y > 200 && mg.y < 250 && mg.uMsg == WM_LBUTTONUP)//修改學生成績的範圍
            {
                Pteacher_GCJ(tea);
            }
            else if (mg.y > 300 && mg.y < 350 && mg.uMsg == WM_LBUTTONUP)//修改學生獲獎的範圍
            {
                Pteacher_GHJ(tea);
            }
            else if (mg.y > 400 && mg.y < 450 && mg.uMsg == WM_LBUTTONUP)//檢視學生排名的範圍
            {
                Pteacher_KPM(tea);
            }
            else if (mg.y > 500 && mg.y < 550 && mg.uMsg == WM_LBUTTONUP)//檢視學生簽到的範圍
            {
                Pteacher_CKQD(tea);
            }
            else if (mg.y > 600 && mg.y < 650 && mg.uMsg == WM_LBUTTONUP)//全校學生通知的範圍
            {
                Pteacher_GMA(tea);
            }
            else if (mg.y > 700 && mg.y < 750 && mg.uMsg == WM_LBUTTONUP)//修改學生處分的範圍
            {
                Pteacherr_GCF(tea);
            }
        }
        else if (mg.x > 1100 && mg.x < 1200 && mg.y > 750 && mg.y < 800 && mg.uMsg == WM_LBUTTONUP)
        {
            save1(L1);
            save2(L2);
            exit(0);
        }
        else if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            PMAIN();
        }
    }
}
void Pstudent(student* stu)
{
    cleardevice();
    IMAGE pmain;//背景
    IMAGE tx1,tx2;
    
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    //loadimage(&tx2, L"tx2.jpg", 200, 300);
    loadimage(&tx1, L"tx1.jpg", 200, 300);
    //putimage(1000, 0, &tx2, NOTSRCERASE);
    putimage(1000, 0, &tx1);// , SRCINVERT);
    
    setbkmode(TRANSPARENT);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(370, 100, L"西柚資訊管理學生端");
    rectangle(1000, 0, 1200, 300);//頭像
    rectangle(1100, 300, 1200, 350);//簽到按鈕
    rectangle(500, 200, 700, 250);//成績檢視
    rectangle(500, 300, 700, 350);//排名檢視
    rectangle(500, 400, 700, 450);//獲獎情況檢視
    rectangle(500, 500, 700, 550);//學習資料推薦
    rectangle(500, 600, 700, 650);//課表檢視
    rectangle(500, 700, 700, 750);//處分資訊檢視
    rectangle(1100, 750, 1199, 799);//退出程式
    rectangle(0, 0, 100, 50);
    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(5, 5, L"返回");//返回
    settextstyle(30, 15, L"微軟雅黑");//簽到字型
    outtextxy(1120, 310, L"簽到");//簽到
    outtextxy(1120, 760, L"退出");//退出程式
    settextstyle(40, 20, L"微軟雅黑");//選項資訊字型格式
    outtextxy(520, 205, L"我的成績");//我的成績
    outtextxy(520, 305, L"我的排名");//我的排名
    outtextxy(520, 405, L"獲獎情況");//獲獎情況
    outtextxy(520, 505, L"學習資料");//學習資料
    outtextxy(520, 605, L"我的課表");//我的課表
    outtextxy(520, 705, L"我的處分");//我的處分
    outtextxy(100, 100, CString(stu->Data.name));//學生名字
    if (stu->Data.qiandao)
    {
        settextstyle(20, 10, L"微軟雅黑");
        outtextxy(720, 400, CString(qiandaoyuji[randnum%20]));
    }
    
    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 500 && mg.x < 700)
        {
            if (mg.y > 200 && mg.y < 250 && mg.uMsg == WM_LBUTTONUP)//我的成績的範圍
            {
                Pstudent_chengji(stu);
            }
            else if (mg.y > 300 && mg.y < 350 && mg.uMsg == WM_LBUTTONUP)//我的排名的範圍
            {
                Pstudent_paiming(stu);
            }
            else if (mg.y > 400 && mg.y < 450 && mg.uMsg == WM_LBUTTONUP)//獲獎情況的範圍
            {
                Pstudent_huojiang(stu);
            }
            else if (mg.y > 500 && mg.y < 550 && mg.uMsg == WM_LBUTTONUP)//學習資料的範圍
            {
                Pstudent_xuexi(stu);
            }
            else if (mg.y > 600 && mg.y < 650 && mg.uMsg == WM_LBUTTONUP)//我的課表的範圍
            {
                Pstudent_kebiao(stu);
            }
            else if (mg.y > 700 && mg.y < 750 && mg.uMsg == WM_LBUTTONUP)//我的處分的範圍
            {
                Pstudent_chufen(stu);
            }
        }
        else if (mg.x > 1100 && mg.x < 1200)//簽到的範圍
        {
            if (mg.y > 300 && mg.y < 350 && mg.uMsg == WM_LBUTTONUP)
            {
                    Pstudent_qiandao(stu);
            }
            else if (mg.y > 750 && mg.y < 800 && mg.uMsg == WM_LBUTTONUP)
            {
                save1(L1);
                save2(L2);
                exit(0);
            }
        }
        else if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50&&mg.uMsg==WM_LBUTTONUP)
        {
            PMAIN();
        }
    }

}
void Pstudent_qiandao(student* stu)//簽到
{
    if (stu->Data.qiandao)
    {
        MessageBox(HD, L"已經簽到過啦>_<", L"簽到資訊", MB_OK);
    }
    else
    {
        stu->Data.qiandao = 1;
        GetLocalTime(&st);
        stu->Data.lastqiandao = st.wYear * 365 + st.wMonth * 30 + st.wDay;
        MessageBox(HD, L"簽到成功 ◍'ㅅ'◍ ♡", L"簽到資訊", MB_OK);
        settextstyle(20, 10, L"微軟雅黑");
        outtextxy(800, 400, CString(qiandaoyuji[randnum % 20]));
    }
}
void Pstudent_chengji(student* stu)//學生成績
{
    cleardevice();
    IMAGE pmain;//主介面圖片
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    char ch[30];
    settextstyle(40, 20, L"微軟雅黑");
    rectangle(0, 0, 100, 50);
    outtextxy(5, 5, L"返回");
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(360, 50, L"我的成績 o(*≧▽≦)ツ");
    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(360, 150, L"我的語文成績:");
    outtextxy(360, 200, L"我的數學成績:");
    outtextxy(360, 250, L"我的英語成績:");
    outtextxy(360, 300, L"我的化學成績:");
    outtextxy(360, 350, L"我的物理成績:");
    outtextxy(360, 400, L"我的C語言成績:");
    if (stu->Data.all_kemu.yuwen < 60)
        settextcolor(RED);
    else if (stu->Data.all_kemu.yuwen < 80)
        settextcolor(YELLOW);
    else
        settextcolor(GREEN);
    ::sprintf(ch, "%d", stu->Data.all_kemu.yuwen);
    outtextxy(700, 150, CString(ch));
    if (stu->Data.all_kemu.shuxue < 60)
        settextcolor(RED);
    else if (stu->Data.all_kemu.shuxue < 80)
        settextcolor(YELLOW);
    else
        settextcolor(GREEN);
    ::sprintf(ch, "%d", stu->Data.all_kemu.shuxue);
    outtextxy(700, 200, CString(ch));
    if (stu->Data.all_kemu.yingyu < 60)
        settextcolor(RED);
    else if (stu->Data.all_kemu.yingyu < 80)
        settextcolor(YELLOW);
    else
        settextcolor(GREEN);
    ::sprintf(ch, "%d", stu->Data.all_kemu.yingyu);
    outtextxy(700, 250, CString(ch));
    if (stu->Data.all_kemu.huaxue < 60)
        settextcolor(RED);
    else if (stu->Data.all_kemu.huaxue < 80)
        settextcolor(YELLOW);
    else
        settextcolor(GREEN);
    ::sprintf(ch, "%d", stu->Data.all_kemu.huaxue);
    outtextxy(700, 300, CString(ch));
    if (stu->Data.all_kemu.wuli < 60)
        settextcolor(RED);
    else if (stu->Data.all_kemu.wuli < 80)
        settextcolor(YELLOW);
    else
        settextcolor(GREEN);
    ::sprintf(ch, "%d", stu->Data.all_kemu.wuli);
    outtextxy(700, 350, CString(ch));
    if (stu->Data.all_kemu.Cyuyan < 60)
        settextcolor(RED);
    else if (stu->Data.all_kemu.Cyuyan < 80)
        settextcolor(YELLOW);
    else
        settextcolor(GREEN);
    ::sprintf(ch, "%d", stu->Data.all_kemu.Cyuyan);
    outtextxy(700, 400, CString(ch));
    settextcolor(WHITE);
    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            Pstudent(stu);
        }
    }
    
}
void Pstudent_paiming(student* stu)//排名功能
{
    cleardevice();
    IMAGE pmain;//主介面圖片
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    char ch[30];
    settextstyle(40, 20, L"微軟雅黑");
    rectangle(0, 0, 100, 50);
    outtextxy(5, 5, L"返回");
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(360, 50, L"我的排名 ︿( ̄︶ ̄)︿");
    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(360, 150, L"我的語文排名:");
    outtextxy(360, 200, L"我的數學排名:");
    outtextxy(360, 250, L"我的英語排名:");
    outtextxy(360, 300, L"我的化學排名:");
    outtextxy(360, 350, L"我的物理排名:");
    outtextxy(360, 400, L"我的C語言排名:");
    outtextxy(360, 450, L"我的總分排名:");
    
    student* p = L1->head;
    int rank[7] = {1,1,1,1,1,1,1};
    for (; p != NULL; p = p->next)
    {
        if (strcmp(stu->Data.ID, p->Data.ID))
        {
            if (stu->Data.all_kemu.yuwen < p->Data.all_kemu.yuwen)
                rank[0]++;
            if (stu->Data.all_kemu.shuxue < p->Data.all_kemu.shuxue)
                rank[1]++;
            if (stu->Data.all_kemu.yingyu < p->Data.all_kemu.huaxue)
                rank[2]++;
            if (stu->Data.all_kemu.wuli < p->Data.all_kemu.wuli)
                rank[3]++;
            if (stu->Data.all_kemu.huaxue < p->Data.all_kemu.huaxue)
                rank[4]++;
            if (stu->Data.all_kemu.Cyuyan < p->Data.all_kemu.Cyuyan)
                rank[5]++;    
            if (stu->Data.all_kemu.score < p->Data.all_kemu.score)
                rank[6]++;
        }
    }
    for (int i = 150, j = 0; j < 7;i+=50, ++j)
    {
        ::sprintf(ch, "%d", rank[j]);
        outtextxy(700, i, CString(ch));
    }
    
    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50&&mg.uMsg== WM_LBUTTONUP)
        {
            Pstudent(stu);
        }
        
    }
}
void Pstudent_huojiang(student* stu)//獲獎情況
{
    cleardevice();
    IMAGE pmain;//主介面圖片
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(360, 50, L"我的獲獎 <( ̄︶ ̄)>");
    settextstyle(40, 20, L"微軟雅黑");
    rectangle(0, 0, 100, 50);
    outtextxy(5, 5, L"返回");
    for (int high = 100, i = 0; i < stu->Data.hjxinxi.loc; i++, high += 50)
    {
        if (*stu->Data.hjxinxi.name[i] != '\0')
            outtextxy(300, high, CString(stu->Data.hjxinxi.name[i]));
    }

    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            Pstudent(stu);
        }
    }
}
void Pstudent_xuexi(student* stu)//學習資料
{
    cleardevice();
    IMAGE pmain;//主介面圖片
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(360, 50, L"西柚資訊學習資料");
    settextstyle(40, 20, L"微軟雅黑");
    rectangle(0, 0, 100, 50);
    outtextxy(5, 5, L"返回");
    outtextxy(100, 150, L"學習網址推薦");
    outtextxy(700, 150, L"學習書籍推薦");
    settextstyle(30, 15, L"微軟雅黑");//網址和書籍字型
    //網址推薦
    outtextxy(100, 200, L"www.cnblogs.com/YHH520/");//我的部落格
    outtextxy(100, 250, L"www.nowcoder.com");//牛客
    outtextxy(100, 300, L"www.icourse163.org");//Mooc 
    outtextxy(100, 350, L"www.luogu.com.cn");//洛谷
    outtextxy(100, 400, L"github.com");//github
    outtextxy(100, 450, L"leetcode-cn.com");//leetcode
    outtextxy(100, 500, L"47.94.129.140/ //西柚的練習網址");//SWPUACM
    outtextxy(100, 550, L"www.bilibili.com");//B站
    //書籍推薦
    outtextxy(700, 200, L"C Primer Plus");
    outtextxy(700, 250, L"資料結構");
    outtextxy(700, 300, L"計算機組成原理");
    outtextxy(700, 350, L"挑戰程式設計競賽");
    outtextxy(700, 400, L"演算法競賽入門經典");
    outtextxy(700, 450, L"演算法導論");
    outtextxy(700, 500, L"程式設計之美");
    outtextxy(700, 550, L"劍指Offer");
    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            Pstudent(stu);
        }
    }
}
void Pstudent_kebiao(student* stu)//課表檢視
{
    cleardevice();
    IMAGE pmain;//主介面圖片
    wchar_t key1[20];
    char key2[20];
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(400, 50, L"我的課表");
    settextstyle(40, 20, L"微軟雅黑");
    rectangle(0, 0, 100, 50);
    outtextxy(5, 5, L"返回");
    outtextxy(220, 250, L"星期一");
    outtextxy(420, 250, L"星期二");
    outtextxy(620, 250, L"星期三");
    outtextxy(820, 250, L"星期四");
    outtextxy(1020, 250, L"星期五");
    outtextxy(30, 330, L"早自習");
    outtextxy(30, 490, L"上午");
    outtextxy(30, 690, L"下午");
    for (int i = 300; i < 799; i += 100)
    {
        line(200, i, 1200, i);
    }
    
    for (int i = 200; i < 1199; i += 200)
    {
        line(i, 300, i, 800);
    }
    line(200, 799, 1200, 799);
    line(1199, 300, 1199, 799);
    for (int i = 0,n=300; i < 5; ++i,n+=100)
    {
        for (int j = 0,m=200; j < 5; ++j,m+=200)
        {
            outtextxy(m+20, n+20, CString(stu->Data.kebiao[i * 5 + j]));
        }
    }

    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            Pstudent(stu);
        }
        else if (mg.y>300 && mg.y < 400 )//第一行
        {
            if (mg.x > 200 && mg.x < 400 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(201, 301));
                clearrectangle(200, 300, 400, 400);
                rectangle(200, 300, 400, 400);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[0], key2);
                outtextxy(220, 320, CString(key2));
                save1(L1);
            }
            else if (mg.x > 400 && mg.x < 600 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(401, 301));
                clearrectangle(400, 300, 600, 400);
                rectangle(400, 300, 600, 400);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[1], key2);
                outtextxy(420, 320, CString(key2));
                save1(L1);
            }
            else if (mg.x > 600 && mg.x < 800 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(601, 301));
                clearrectangle(600, 300, 800, 400);
                rectangle(600, 300, 800, 400);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[2], key2);
                outtextxy(620, 320, CString(key2));
                save1(L1);
            }
            else if (mg.x > 800 && mg.x < 1000 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(801, 301));
                clearrectangle(800, 300, 1000, 400);
                rectangle(800, 300, 1000, 400);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[3], key2);
                outtextxy(820, 320, CString(key2));
                save1(L1);
            }
            else if (mg.x > 1000 && mg.x < 1200 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(1001, 301));
                clearrectangle(1000, 300, 1200, 400);
                rectangle(1000, 300, 1199, 400);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[4], key2);
                outtextxy(1020, 320, CString(key2));
                save1(L1);
            }
        }
        else if (mg.y > 400 && mg.y < 500)//第二行
        {
            if (mg.x > 200 && mg.x < 400 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(201, 401));
                clearrectangle(200, 400, 400, 500);
                rectangle(200, 400, 400, 500);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[5], key2);
                outtextxy(220, 420, CString(key2));
                save1(L1);
            }
            else if (mg.x > 400 && mg.x < 600 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(401, 401));
                clearrectangle(400, 400, 600, 500);
                rectangle(200, 400, 400, 500);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[6], key2);
                outtextxy(420, 420, CString(key2));
                save1(L1);
            }
            else if (mg.x > 600 && mg.x < 800 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(601, 401));
                clearrectangle(600, 400, 800, 500);
                rectangle(600, 400, 800, 500);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[7], key2);
                outtextxy(620, 420, CString(key2));
                save1(L1);
            }
            else if (mg.x > 800 && mg.x < 1000 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(401, 401));
                clearrectangle(800, 400, 1000, 500);
                rectangle(800, 400, 1000, 500);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[8], key2);
                outtextxy(820, 420, CString(key2));
                save1(L1);
            }
            else if (mg.x > 1000 && mg.x < 1200 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(1001, 401));
                clearrectangle(1000, 400, 1200, 500);
                rectangle(1000, 400, 1200, 500);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[9], key2);
                outtextxy(1020, 420, CString(key2));
                save1(L1);
            }
        }
        else if (mg.y > 500 && mg.y < 600 )//第三行
        {
            if (mg.x > 200 && mg.x < 400 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(201, 501));
                clearrectangle(200, 500, 400, 600);
                rectangle(200, 500, 400, 600);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[10], key2);
                outtextxy(220, 520, CString(key2));
                save1(L1);
            }
            else if (mg.x > 400 && mg.x < 600 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(401, 501));
                clearrectangle(400, 500, 600, 600);
                rectangle(400, 500, 600, 600);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[11], key2);
                outtextxy(420, 520, CString(key2));
                save1(L1);
            }
            else if (mg.x > 600 && mg.x < 800 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(601, 501));
                clearrectangle(600, 500, 800, 600);
                rectangle(600, 500, 400, 800);
                InputBox(key1,5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[12], key2);
                outtextxy(620, 520, CString(key2));
                save1(L1);
            }
            else if (mg.x > 800 && mg.x < 1000 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(801, 501));
                clearrectangle(800, 500, 1000, 600);
                rectangle(800, 500, 1000, 600);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[13], key2);
                outtextxy(820, 520, CString(key2));
                save1(L1);
            }
            else if (mg.x > 1000 && mg.x < 1200 && mg.uMsg == WM_LBUTTONUP)
            {
                setbkcolor(getpixel(1001, 501));
                clearrectangle(1000, 500, 1200, 600);
                rectangle(1000, 500, 1200, 600);
                InputBox(key1, 5, L"請輸入學科");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                strcpy_s(stu->Data.kebiao[14], key2);
                outtextxy(1020, 520, CString(key2));
                save1(L1);
            }
        }
        else if (mg.y > 600 && mg.y < 700)//第四行
        {
        if (mg.x > 200 && mg.x < 400 && mg.uMsg == WM_LBUTTONUP)
        {
            setbkcolor(getpixel(201, 601));
            clearrectangle(200, 600, 400, 700);
            rectangle(200, 600, 400, 700);
            InputBox(key1, 5, L"請輸入學科");
            WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
            strcpy_s(stu->Data.kebiao[15], key2);
            outtextxy(220, 620, CString(key2));
            save1(L1);
        }
        else if (mg.x > 400 && mg.x < 600 && mg.uMsg == WM_LBUTTONUP)
        {
            setbkcolor(getpixel(401, 601));
            clearrectangle(400, 600, 600, 700);
            rectangle(400, 600, 600, 700);
            InputBox(key1, 5, L"請輸入學科");
            WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
            strcpy_s(stu->Data.kebiao[16], key2);
            outtextxy(420, 620, CString(key2));
            save1(L1);
        }
        else if (mg.x > 600 && mg.x < 800 && mg.uMsg == WM_LBUTTONUP)
        {
            setbkcolor(getpixel(601, 601));
            clearrectangle(600, 600, 800, 700);
            rectangle(600, 600, 800, 700);
            InputBox(key1, 5, L"請輸入學科");
            WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
            strcpy_s(stu->Data.kebiao[17], key2);
            outtextxy(620, 620, CString(key2));
            save1(L1);
        }
        else if (mg.x > 800 && mg.x < 1000 && mg.uMsg == WM_LBUTTONUP)
        {
            setbkcolor(getpixel(801, 601));
            clearrectangle(800, 600, 1000, 700);
            rectangle(800, 600, 1000, 700);
            InputBox(key1, 5, L"請輸入學科");
            WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
            strcpy_s(stu->Data.kebiao[18], key2);
            outtextxy(820, 620, CString(key2));
            save1(L1);
        }
        else if (mg.x > 1000 && mg.x < 1200 && mg.uMsg == WM_LBUTTONUP)
        {
            setbkcolor(getpixel(1001, 601));
            clearrectangle(1000, 600, 1200, 700);
            rectangle(1000, 600, 1200, 700);
            InputBox(key1, 5, L"請輸入學科");
            WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
            strcpy_s(stu->Data.kebiao[19], key2);
            outtextxy(1020, 620, CString(key2));
            save1(L1);
        }
        }
        else if (mg.y > 700 && mg.y < 800 )//第五行
        {

        if (mg.x > 200 && mg.x < 400 && mg.uMsg == WM_LBUTTONUP)
        {
            setbkcolor(getpixel(201, 701));
            clearrectangle(200, 700, 400, 800);
            rectangle(200, 700, 400, 799);
            InputBox(key1, 5, L"請輸入學科");
            WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
            strcpy_s(stu->Data.kebiao[20], key2);
            outtextxy(220, 720, CString(key2));
            save1(L1);
        }
        else if (mg.x > 400 && mg.x < 600 && mg.uMsg == WM_LBUTTONUP)
        {
            setbkcolor(getpixel(401, 701));
            clearrectangle(400, 700, 600, 800);
            rectangle(400, 700, 600, 799);
            InputBox(key1, 5, L"請輸入學科");
            WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
            strcpy_s(stu->Data.kebiao[21], key2);
            outtextxy(420, 720, CString(key2));
            save1(L1);
        }
        else if (mg.x > 600 && mg.x < 800 && mg.uMsg == WM_LBUTTONUP)
        {
            setbkcolor(getpixel(601, 701));
            clearrectangle(600, 700, 800, 800);
            rectangle(600, 700, 800, 799);
            InputBox(key1, 5, L"請輸入學科");
            WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
            strcpy_s(stu->Data.kebiao[22], key2);
            outtextxy(620, 720, CString(key2));
            save1(L1);
        }
        else if (mg.x > 800 && mg.x < 1000 && mg.uMsg == WM_LBUTTONUP)
        {
            setbkcolor(getpixel(801, 701));
            clearrectangle(800, 700, 1000, 800);
            rectangle(800, 700, 1000, 799);
            InputBox(key1, 5, L"請輸入學科");
            WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
            strcpy_s(stu->Data.kebiao[23], key2);
            outtextxy(820, 720, CString(key2));
            save1(L1);
        }
        else if (mg.x > 1000 && mg.x < 1200 && mg.uMsg == WM_LBUTTONUP)
        {
            setbkcolor(getpixel(1001, 701));
            clearrectangle(1000, 700, 1199, 800);
            rectangle(1000, 700, 1199, 799);
            InputBox(key1, 5, L"請輸入學科");
            WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
            strcpy_s(stu->Data.kebiao[24], key2);
            outtextxy(1020, 720, CString(key2));
            save1(L1);
        }
        }
        
    }
}
void Pstudent_chufen(student* stu)//處分資訊
{
    cleardevice();
    IMAGE pmain;//主介面圖片
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(360, 50, L"我的處分資訊");
    settextstyle(40, 20, L"微軟雅黑");
    rectangle(0, 0, 100, 50);
    outtextxy(5, 5, L"返回");
    //chufen* p = stu->Data.cfxinxi.next;
    for (int high=100,i=0; i< stu->Data.cfxinxi.loc; i++,high+=50)
    {
        if(*stu->Data.cfxinxi.name[i]!='\0')
        outtextxy(300, high, CString(stu->Data.cfxinxi.name[i]));
    }
    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            Pstudent(stu);
        }
    }
}
void Pteacher_GCJ(teacher* tea)
{
    cleardevice();
    IMAGE pmain;//主介面圖片
    wchar_t xuehao[25];//讀取輸入資訊
    char xuehao2[25];//
    wchar_t key1[10];
    char key2[10];
    student* temp=NULL;
    ::memset(xuehao, 0, sizeof(xuehao));
    ::memset(xuehao2, 0, sizeof(xuehao2));
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    rectangle(550, 200, 880, 250);//學生學號輸入視窗
    rectangle(920, 200, 1020, 250);
    for (int i = 400; i < 700; i += 100)
    {
        rectangle(450, i, 550, i+50);
    }
    for (int i = 400; i < 700; i += 100)
    {
        rectangle(850, i, 950, i + 50);
    }
    

    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(360, 50, L"修改學生成績");

    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(350, 200, L"學生學號:");
    outtextxy(350, 300, L"學生資訊:");
    outtextxy(300, 400, L"語文:");
    outtextxy(300, 500, L"數學:");
    outtextxy(300, 600, L"英語:");
    outtextxy(700, 400, L"物理:");
    outtextxy(700, 500, L"化學:");
    outtextxy(700, 600, L"C語言:");
    outtextxy(930, 205, L"確定");
    rectangle(0, 0, 100, 50);
    outtextxy(5, 5, L"返回");

    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            Pteacher(tea);
        }
        else if (mg.y > 200 && mg.y < 250)
        {
        if (mg.x > 550 && mg.x < 880 && mg.uMsg == WM_LBUTTONUP)
        {
            setbkcolor(getpixel(601, 201));
            clearrectangle(550, 200, 880, 250);
            rectangle(550, 200, 880,  250);
            InputBox(xuehao, 13, L"請輸入正確的學生學號哦(* ̄3 ̄)╭");
            WideCharToMultiByte(CP_ACP, 0, xuehao, -1, xuehao2, wcslen(xuehao) * 2 + 1, NULL, NULL);
            outtextxy(560, 210, xuehao);
        }
        else if (mg.x > 920 && mg.x < 1020 && mg.uMsg == WM_LBUTTONUP)
        {
            
            if (*xuehao2 != '\0')
            {
                temp = find_stuID(L1, xuehao2);
                if (temp)
                {
                    char fenshu[15];
                    for (int i = 400; i < 700; i += 100)
                    {
                        setbkcolor(getpixel(451, i + 1));
                        clearrectangle(450, i, 550, i + 50);
                        rectangle(450, i, 550, i + 50);
                    }
                    for (int i = 400; i < 700; i += 100)
                    {
                        setbkcolor(getpixel(851, i + 1));
                        clearrectangle(850, i, 950, i + 50);
                        rectangle(850, i, 950, i + 50);
                    }
                    outtextxy(560, 305, CString(temp->Data.name));
                    ::sprintf(fenshu, "%d", temp->Data.all_kemu.yuwen);
                    outtextxy(460, 405, CString(fenshu));
                    ::sprintf(fenshu, "%d", temp->Data.all_kemu.shuxue);
                    outtextxy(460, 505, CString(fenshu));
                    ::sprintf(fenshu, "%d", temp->Data.all_kemu.yingyu);
                    outtextxy(460, 605, CString(fenshu));
                    ::sprintf(fenshu, "%d", temp->Data.all_kemu.wuli);
                    outtextxy(860, 405, CString(fenshu));
                    ::sprintf(fenshu, "%d", temp->Data.all_kemu.huaxue);
                    outtextxy(860, 505, CString(fenshu));
                    ::sprintf(fenshu, "%d", temp->Data.all_kemu.Cyuyan);
                    outtextxy(860, 605, CString(fenshu));
                    save1(L1);
                }
                else
                {
                    MessageBox(HD, L"沒有該學生的資訊\n請檢查學號是否正確(>﹏<)", L"查詢學生資訊", MB_OK);
                }
            }
            else
            {
                MessageBox(HD, L"沒有該學生的資訊\n請檢查學號是否正確(>﹏<)", L"查詢學生資訊",MB_OK);
            }
        }
        }
        else if (mg.x > 450 && mg.x < 550 && mg.y>400 && mg.y < 450 && mg.uMsg == WM_LBUTTONUP)//語文成績
        {
            if (*xuehao2)
            {
                if (temp)
                {
                    setbkcolor(getpixel(451, 401));
                    clearrectangle(450, 400, 550, 450);
                    rectangle(450, 400, 550, 450);
                    InputBox(key1, 4, L"請輸入學生語文成績 ヾ(´∀`o)+");
                    WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                    outtextxy(460, 405, key1);
                    temp->Data.all_kemu.score += atoi(key2) - temp->Data.all_kemu.yuwen;
                    temp->Data.all_kemu.yuwen = atoi(key2);

                    save1(L1);
                }
                else
                    MessageBox(HD, L"沒有該學生的資訊\n請檢查學號是否正確(>﹏<)", L"查詢學生資訊", MB_OK);
            }
            else
                MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.x > 450 && mg.x < 550 && mg.y>500 && mg.y < 550 && mg.uMsg == WM_LBUTTONUP)//數學成績
        {
            if (*xuehao2)
            {
                if (temp)
                {
                    setbkcolor(getpixel(451, 551));
                    clearrectangle(450, 500, 550, 550);
                    rectangle(450, 500, 550, 550);
                    InputBox(key1, 4, L"請輸入學生數學成績 ヾ(´∀`o)+");
                    WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                    outtextxy(460, 505, key1);
                    temp->Data.all_kemu.score += atoi(key2) - temp->Data.all_kemu.shuxue;
                    temp->Data.all_kemu.shuxue = atoi(key2);
                    save1(L1);
                }
                else
                    MessageBox(HD, L"沒有該學生的資訊\n請檢查學號是否正確(>﹏<)", L"查詢學生資訊", MB_OK);
            }
            else
            MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.x > 450 && mg.x < 550 && mg.y>600 && mg.y < 650 && mg.uMsg == WM_LBUTTONUP)//英語成績
        {
            if (*xuehao2)
            {
                if (temp)
                {
                    setbkcolor(getpixel(451, 601));
                    clearrectangle(450, 600, 550, 650);
                    rectangle(450, 600, 550, 650);
                    InputBox(key1, 4, L"請輸入學生英語成績 ヾ(´∀`o)+");
                    WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                    outtextxy(460, 605, key1);
                    temp->Data.all_kemu.score += atoi(key2) - temp->Data.all_kemu.yingyu;
                    temp->Data.all_kemu.yingyu = atoi(key2);
                    save1(L1);
                }
                else
                {
                    MessageBox(HD, L"沒有該學生的資訊\n請檢查學號是否正確(>﹏<)", L"查詢學生資訊", MB_OK);
                }
            }
            else
                MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.x > 850 && mg.x < 950 && mg.y>400 && mg.y < 450 && mg.uMsg == WM_LBUTTONUP)//物理成績
        {
            if (*xuehao2)
            {
                if (temp)
                {
                    setbkcolor(getpixel(851, 401));
                    clearrectangle(850, 400, 950, 450);
                    rectangle(850, 400, 950, 450);
                    InputBox(key1, 4, L"請輸入學生物理成績 ヾ(´∀`o)+");
                    WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                    outtextxy(860, 405, key1);
                    temp->Data.all_kemu.score += atoi(key2) - temp->Data.all_kemu.wuli;
                    temp->Data.all_kemu.wuli = atoi(key2);
                    save1(L1);
                }
                else
                    MessageBox(HD, L"沒有該學生的資訊\n請檢查學號是否正確(>﹏<)", L"查詢學生資訊", MB_OK);
            }
            else
                MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.x > 850 && mg.x < 950 && mg.y>500 && mg.y < 550 && mg.uMsg == WM_LBUTTONUP)//化學成績
        {
            if (*xuehao2)
            {
                if (temp)
                {
                    setbkcolor(getpixel(851, 501));
                    clearrectangle(850, 500, 950, 550);
                    rectangle(850, 500, 950, 550);
                    InputBox(key1, 4, L"請輸入學生成績 ヾ(´∀`o)+");
                    WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                    outtextxy(860, 505, key1);
                    temp->Data.all_kemu.score += atoi(key2) - temp->Data.all_kemu.huaxue;
                    temp->Data.all_kemu.huaxue = atoi(key2);
                    save1(L1);
                }
                else
                    MessageBox(HD, L"沒有該學生的資訊\n請檢查學號是否正確(>﹏<)", L"查詢學生資訊", MB_OK);
            }
            else
            MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.x > 850 && mg.x < 950 && mg.y>600 && mg.y < 650 && mg.uMsg == WM_LBUTTONUP)//C語言成績
        {
            if (*xuehao2)
            {
                if (temp)
                {
                    setbkcolor(getpixel(851, 601));
                    clearrectangle(850, 600, 950, 650);
                    rectangle(850, 600, 950, 650);
                    InputBox(key1, 4, L"請輸入學生C語言成績 ヾ(´∀`o)+");
                    WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                    outtextxy(860, 605, key1);
                    temp->Data.all_kemu.score += atoi(key2) - temp->Data.all_kemu.Cyuyan;
                    temp->Data.all_kemu.Cyuyan = atoi(key2);
                    save1(L1);
                }
                else
                    MessageBox(HD, L"沒有該學生的資訊\n請檢查學號是否正確(>﹏<)", L"查詢學生資訊", MB_OK);
            }
            else
            MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
    }
}
void Pteacher_GHJ(teacher* tea)
{
    cleardevice();
    IMAGE pmain;//主介面圖片
    wchar_t xuehao[25];//讀取輸入資訊
    char xuehao2[25];//
    wchar_t key1[100];
    char key2[100];
    student* temp = NULL;
    ::memset(xuehao, 0, sizeof(xuehao));
    ::memset(xuehao2, 0, sizeof(xuehao2));
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    rectangle(550, 120, 880, 170);//學生學號輸入視窗
    rectangle(920, 120, 1020, 170);
    rectangle(0, 0, 100, 50);
    rectangle(500, 300, 950, 350);//1
    rectangle(500, 400, 950, 450);//2
    rectangle(500, 500, 950, 550);//3
    rectangle(500, 600, 950, 650);//4
    rectangle(500, 700, 950, 750);//5
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(360, 40, L"修改學生獲獎");

    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(350, 120, L"學生學號:");
    outtextxy(350, 200, L"學生資訊:");
    outtextxy(930, 125, L"確定");
    for (int i = 300; i <= 700; i += 100)
    {
        outtextxy(300, i, L"獲獎資訊:");
    }
    outtextxy(5, 5, L"返回");

    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            Pteacher(tea);
        }
        else if (mg.x > 550 && mg.x < 880 && mg.y>120 && mg.y < 170&&mg.uMsg==WM_LBUTTONUP)//學號輸入框
        {
             setbkcolor(getpixel(601, 201));
             clearrectangle(550, 120, 880, 170);
             rectangle(550, 120, 880, 170);
             InputBox(xuehao, 13, L"請輸入正確的學生學號哦(* ̄3 ̄)╭");
             WideCharToMultiByte(CP_ACP, 0, xuehao, -1, xuehao2, wcslen(xuehao) * 2 + 1, NULL, NULL);
             outtextxy(560, 130, xuehao);
        }
        else if (mg.y > 120 && mg.y < 170 && mg.x > 920 && mg.x < 1020 && mg.uMsg == WM_LBUTTONUP)//確認按鈕
        {
            if (*xuehao2 != '\0')
            {
                temp = find_stuID(L1, xuehao2);
                if (temp)
                {
                    outtextxy(550, 200, CString(temp->Data.name));
                    for (int i = 0,j=305; i < 5; ++i,j+=100)
                    {
                        outtextxy(510, j, CString(temp->Data.hjxinxi.name[i]));
                    }
                }
                else
                {
                    MessageBox(HD, L"沒有該學生的資訊\n請檢查學號是否正確(>﹏<)", L"查詢學生資訊", MB_OK);
                }
            }
            else
                MessageBox(HD, L"沒有該學生的資訊\n請檢查學號是否正確(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.y > 300 && mg.y < 350 && mg.x > 500 && mg.x < 950 && mg.uMsg == WM_LBUTTONUP)//1
        {
            if (temp)
            {
                setbkcolor(getpixel(501, 301));
                clearrectangle(500, 300, 950, 350);
                rectangle(500, 300, 950, 350);
                InputBox(key1, 20, L"請輸入學生獲獎情況");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                outtextxy(505, 305, key1);
                strcpy(temp->Data.hjxinxi.name[0], key2);
                temp->Data.hjxinxi.loc = 1;
                save1(L1);
            }
            else
            {
                MessageBox(HD, L"請先輸入正確學生學號(>﹏<)", L"查詢學生資訊", MB_OK);
            }
        }
        else if (mg.y > 400 && mg.y < 450 && mg.x > 500 && mg.x < 950 && mg.uMsg == WM_LBUTTONUP)//2
        {
            if (temp)
            {
                setbkcolor(getpixel(501, 401));
                clearrectangle(500, 400, 950, 450);
                rectangle(500, 400, 950, 450);
                InputBox(key1, 20, L"請輸入學生獲獎情況");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                outtextxy(505, 405, key1);
                strcpy(temp->Data.hjxinxi.name[1], key2);
                temp->Data.hjxinxi.loc = 2;
                save1(L1);
            }
            else
                MessageBox(HD, L"請先輸入正確學生學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.y > 500 && mg.y < 550 && mg.x > 500 && mg.x < 950 && mg.uMsg == WM_LBUTTONUP)//3
        {
            if (temp)
            {
                setbkcolor(getpixel(501, 501));
                clearrectangle(500, 500, 950, 550);
                rectangle(500, 500, 950, 550);
                InputBox(key1, 20, L"請輸入學生獲獎情況");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                outtextxy(505, 505, key1);
                strcpy(temp->Data.hjxinxi.name[2], key2);
                temp->Data.hjxinxi.loc = 3;
                save1(L1);
            }
            else
                MessageBox(HD, L"請先輸入正確學生學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.y > 600 && mg.y < 650 && mg.x > 500 && mg.x < 950 && mg.uMsg == WM_LBUTTONUP)//4
        {
            if (temp)
            {
                setbkcolor(getpixel(501, 601));
                clearrectangle(500, 600, 950, 650);
                rectangle(500, 600, 950, 650);
                InputBox(key1, 20, L"請輸入學生獲獎情況");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                outtextxy(505, 605, key1);
                strcpy(temp->Data.hjxinxi.name[3], key2);
                temp->Data.hjxinxi.loc = 4;
                save1(L1);
            }
            else
                MessageBox(HD, L"請先輸入正確學生學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.y > 700 && mg.y < 750 && mg.x > 500 && mg.x < 950 && mg.uMsg == WM_LBUTTONUP)//5
        {
            if (temp)
            {
                setbkcolor(getpixel(501, 701));
                clearrectangle(500, 700, 950, 750);
                rectangle(500, 700, 950, 750);
                InputBox(key1, 20, L"請輸入學生獲獎情況");
                WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                outtextxy(505, 705, key1);
                strcpy(temp->Data.hjxinxi.name[4], key2);
                temp->Data.hjxinxi.loc = 5;
                save1(L1);
            }
            else
                MessageBox(HD, L"請先輸入正確學生學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
    }
}
void Pteacher_KPM(teacher* tea)
{
    cleardevice();
    IMAGE pmain;//主介面圖片
    priority_queue<pair<int, const char*> >q;
    student* p=L1->head;
    for (; p; p = p->next)
    {
        q.push({ p->Data.all_kemu.score,p->Data.name });
    }
    wchar_t xuehao[25];//讀取輸入資訊
    char xuehao2[25];//
    char key2[100];
    student* temp = NULL;
    ::memset(xuehao, 0, sizeof(xuehao));
    ::memset(xuehao2, 0, sizeof(xuehao2));
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    rectangle(800, 150, 1199, 200);//學生學號輸入視窗
    rectangle(1100, 200, 1199, 250);//確認按鈕
    rectangle(0, 0, 100, 50);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(400, 40, L"檢視學生排名");
    
    
    settextcolor(GREEN);
    outtextxy(200, 100, L"前五名學生");
    settextcolor(WHITE);
    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(5, 5, L"返回");
    outtextxy(800, 100, L"查詢學生排名");
    outtextxy(680, 150, L"學號:");
    outtextxy(1110, 210, L"確定");
    outtextxy(680, 300, L"學生資訊:");

    outtextxy(680, 400, L"語文排名  :");
    outtextxy(680, 450, L"數學排名  :");
    outtextxy(680, 500, L"英語排名  :");
    outtextxy(680, 550, L"物理排名  :");
    outtextxy(680, 600, L"化學排名  :");
    outtextxy(680, 650, L"C語言排名:");
    outtextxy(680, 700, L"總分排名  :");
    
    
    for (int i = 0,j=200; i < 5 && q.size(); ++i,j+=100, q.pop())
    {
        sprintf(key2, "%d", q.top().first);
        outtextxy(200, j,CString(key2) );
        outtextxy(300, j, CString(q.top().second));
    }
    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            Pteacher(tea);
        }
        else if (mg.x > 800 && mg.x < 1200 && mg.y>150 && mg.y < 200 && mg.uMsg == WM_LBUTTONUP)
        {
            setbkcolor(getpixel(801, 151));
            clearrectangle(800, 150, 1200, 200);
            rectangle(800, 150, 1200, 200);
            InputBox(xuehao, 13, L"請輸入正確的學生學號哦(* ̄3 ̄)╭");
            WideCharToMultiByte(CP_ACP, 0, xuehao, -1, xuehao2, wcslen(xuehao) * 2 + 1, NULL, NULL);
            outtextxy(810, 160, xuehao);
        }
        else if (mg.x > 1100 && mg.x < 1200 && mg.y>200 && mg.y < 250 && mg.uMsg == WM_LBUTTONUP)
        {
            if (*xuehao2)
            {
                temp = find_stuID(L1, xuehao2);
                if (temp)
                {
                    setbkcolor(getpixel(801, 151));
                    clearrectangle(890,290,1100,350 );
                    outtextxy(900, 300, CString(temp->Data.name));
                    char ch[10];
                    memset(ch, 0, sizeof(ch));
                    int rank[7] = { 1,1,1,1,1,1,1 };
                    for (p = L1->head; p != NULL; p = p->next)
                    {
                        if (strcmp(temp->Data.ID, p->Data.ID))
                        {
                            if (temp->Data.all_kemu.yuwen < p->Data.all_kemu.yuwen)
                                rank[0]++;
                            if (temp->Data.all_kemu.shuxue < p->Data.all_kemu.shuxue)
                                rank[1]++;
                            if (temp->Data.all_kemu.yingyu < p->Data.all_kemu.huaxue)
                                rank[2]++;
                            if (temp->Data.all_kemu.wuli < p->Data.all_kemu.wuli)
                                rank[3]++;
                            if (temp->Data.all_kemu.huaxue < p->Data.all_kemu.huaxue)
                                rank[4]++;
                            if (temp->Data.all_kemu.Cyuyan < p->Data.all_kemu.Cyuyan)
                                rank[5]++;
                            if (temp->Data.all_kemu.score < p->Data.all_kemu.score)
                                rank[6]++;
                        }
                    }
                    for (int i = 410, j = 0; j < 7; i += 50, ++j)
                    {
                        ::sprintf(ch, "%d", rank[j]);
                        setbkcolor(getpixel(901, i));
                        clearrectangle(900, i - 10, 1000, i + 50);
                        outtextxy(910, i, CString(ch));
                    }
                }
                else
                {
                    MessageBox(HD, L"未找到該學生資訊=_=", L"學號輸入資訊", MB_OK);
                }
            }
            else
            {
                MessageBox(HD, L"請先輸入學號=_=", L"學號輸入資訊", MB_OK);
            }
        }
    }
}
void Pteacher_GMA(teacher* tea)
{
    cleardevice();
    IMAGE pmain;//背景圖
    student* stu=NULL;
    wchar_t xuehao1[25];
    char xuehao2[25];
    wchar_t mima1[25];
    char mima2[25];
    memset(mima1, 0, sizeof(mima1));
    memset(mima2, 0, sizeof(mima2));
    memset(xuehao1, 0, sizeof(xuehao1));
    memset(xuehao2, 0, sizeof(xuehao2));
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(400, 200, L"學生密碼修改");
    rectangle(0, 0, 100, 50);
    rectangle(900, 350, 1000, 400);//確定
    rectangle(500, 350, 900, 400);
    rectangle(500, 450, 900, 500);
    rectangle(500, 550, 900, 600);
    rectangle(500, 650, 900, 700);
    rectangle(650, 750, 850, 799);
    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(5, 5, L"返回");
    outtextxy(200, 350, L"學號:");
    outtextxy(200, 450, L"學生資訊:");
    outtextxy(200, 550, L"原密碼:");
    outtextxy(200, 650, L"新密碼:");
    outtextxy(910, 355, L"確定");
    outtextxy(660, 755, L"確定修改");

    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            Pteacher(tea);
        }
        else if (mg.x > 500 && mg.x < 900 && mg.y>350 && mg.y < 400 && mg.uMsg == WM_LBUTTONUP)//學號輸入
        {
            setbkcolor(getpixel(501, 351));
            clearrectangle(500, 350, 900, 400);
            rectangle(500, 350, 900, 400);
            InputBox(xuehao1, 13, L"請輸入學號");
            WideCharToMultiByte(CP_ACP, 0, xuehao1, -1, xuehao2, wcslen(xuehao1) * 2 + 1, NULL, NULL);
            outtextxy(510, 355, xuehao1);
        }
        else if (mg.x > 900 && mg.x < 1000 && mg.y>350 && mg.y < 400 && mg.uMsg == WM_LBUTTONUP)//確定按鈕
        {
            if (*xuehao2)
            {
                stu = find_stuID(L1, xuehao2);
                if (stu)
                {
                    setbkcolor(getpixel(501, 451));
                    clearrectangle(500, 450, 900, 500);
                    rectangle(500, 450, 900, 500);
                    outtextxy(510, 455, CString(stu->Data.name));
                    setbkcolor(getpixel(501, 551));
                    clearrectangle(500, 550, 900, 600);
                    rectangle(500, 550, 900, 600);
                    outtextxy(510, 555, CString(stu->Data.mima));
                }
                else
                {
                    MessageBox(HD, L"沒有該學生資訊哦", L"學生資訊", MB_OK);
                }
            }
            else
            {
                MessageBox(HD, L"請先輸入學生學號", L"學生資訊", MB_OK);
            }
        }
        else if (mg.x > 500 && mg.x < 900 && mg.y>650 && mg.y < 700 && mg.uMsg == WM_LBUTTONUP)//新密碼輸入框
        {
            if (*xuehao2)
            {
                if (stu)
                {
                    setbkcolor(getpixel(501, 651));
                    clearrectangle(500, 650, 900, 700);
                    rectangle(500, 650, 900, 700);
                    InputBox(mima1, 13, L"請輸入新密碼");
                    WideCharToMultiByte(CP_ACP, 0, mima1, -1, mima2, wcslen(mima1) * 2 + 1, NULL, NULL);
                    outtextxy(510, 655, mima1);
                }
                else
                {
                    MessageBox(HD, L"沒有該學生資訊哦", L"學生資訊", MB_OK);
                }
            }
            else
            {
                MessageBox(HD, L"請先輸入學生學號", L"學生資訊", MB_OK);
            }
        }
        else if (mg.x > 650 && mg.x < 750 && mg.y>750 && mg.y < 799 && mg.uMsg == WM_LBUTTONUP)//確當修改框
        {
            if (*xuehao2)
            {
                if (stu)
                {
                    strcpy_s(stu->Data.mima, mima2);
                    save1(L1);
                    MessageBox(HD, L"學生密碼修改成功", L"學生資訊", MB_OK);
                }
                else
                {
                    MessageBox(HD, L"沒有該學生資訊哦", L"學生資訊", MB_OK);
                }
            }
            else
            {
                MessageBox(HD, L"請先輸入學生學號", L"學生資訊", MB_OK);
            }
        }
    }
}
void Pteacher_CKQD(teacher* tea)
{
    cleardevice();
    IMAGE pmain;//主介面圖片
    wchar_t xuehao[25];//讀取輸入資訊
    char xuehao2[25];//
    student* temp = NULL;
    ::memset(xuehao, 0, sizeof(xuehao));
    ::memset(xuehao2, 0, sizeof(xuehao2));
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    rectangle(550, 120, 870, 170);//學生學號輸入視窗
    rectangle(870, 120, 970, 170);
    rectangle(0, 0, 100, 50);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(360, 40, L"檢視學生簽到情況");

    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(350, 120, L"學生學號:");
    outtextxy(350, 200, L"學生資訊:");
    outtextxy(880, 125, L"確定");
    outtextxy(5, 5, L"返回");
    int tol_renshu=0,tol_qiandaoshu=0;//tol_renshu是總人數,tol_qiandaoshu是簽到的人數
    char tol_RS[10], tol_QDRS[10];
    student* p = L1->head;
    for (; p; p = p->next)
    {
        if (p->Data.qiandao)
            ++tol_qiandaoshu;
        ++tol_renshu;
    }
    ::sprintf(tol_RS, "%d",tol_renshu);
    ::sprintf(tol_QDRS, "%d", tol_qiandaoshu);
    outtextxy(100, 300, L"學生總人數:");
    outtextxy(100, 400, L"簽到的學生數目:");
    outtextxy(450, 300, CString(tol_RS));
    outtextxy(450, 400, CString(tol_QDRS));
    outtextxy(600, 300, L"未簽到學生:");
    outtextxy(850, 200, L"簽到情況:");

    p = L1->head;
    for (int j=350,i=600; p; p = p->next)
    {
        if (j > 800)
        {
            j = 350;
            i += 200;
        }
        if (!p->Data.qiandao)
        {
            settextcolor(RED);
            outtextxy(i, j, CString(p->Data.name));//輸出未簽到的名字
            j += 50;
            settextcolor(WHITE);
        }
    }
    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            Pteacher(tea);
        }
        else if (mg.x > 550 && mg.x < 870 && mg.y>120 && mg.y < 170&&mg.uMsg==WM_LBUTTONUP)
        {
            setbkcolor(getpixel(551, 121));
            clearrectangle(550, 120, 870, 170);
            rectangle(550, 120, 870, 170);
            InputBox(xuehao, 13, L"請輸入正確的學生學號哦(* ̄3 ̄)╭");
            WideCharToMultiByte(CP_ACP, 0, xuehao, -1, xuehao2, wcslen(xuehao) * 2 + 1, NULL, NULL);
            outtextxy(560, 130, xuehao);
        }
        else if (mg.x > 850 && mg.x < 970 && mg.y>120 && mg.y < 170 && mg.uMsg == WM_LBUTTONUP)
        {
            if (*xuehao2)
            {
                temp = find_stuID(L1, xuehao2);
                if (temp)
                {
                    if (temp->Data.qiandao)
                    {
                        setbkcolor(getpixel(601, 201));
                        clearrectangle(540, 200, 750, 240);
                        outtextxy(550, 200, CString(temp->Data.name));
                        setbkcolor(getpixel(1051, 201));
                        clearrectangle(1040, 200, 1199, 240);
                        settextcolor(GREEN);
                        outtextxy(1050, 200, L"已簽到");
                        settextcolor(WHITE);
                    }
                    else
                    {
                        setbkcolor(getpixel(601, 201));
                        clearrectangle(540, 200, 750, 240);
                        outtextxy(550, 200, CString(temp->Data.name));
                        setbkcolor(getpixel(1051, 201));
                        clearrectangle(1040, 200, 1199, 240);
                        settextcolor(RED);
                        outtextxy(1050, 200, L"未簽到");
                        settextcolor(WHITE);
                    }
                }
                else
                {
                    MessageBox(HD, L"未找到該學生資訊=_=", L"學號輸入資訊", MB_OK);
                }
            }
            else
            {
                MessageBox(HD, L"請先輸入學號=_=", L"學號輸入資訊", MB_OK);
            }
        }
    
    }
}
void Pteacherr_GCF(teacher* tea)
{
    cleardevice();
    IMAGE pmain;//主介面圖片
    wchar_t xuehao[25];//讀取輸入資訊
    char xuehao2[25];//
    wchar_t key1[100];
    char key2[100];
    student* temp = NULL;
    ::memset(xuehao, 0, sizeof(xuehao));
    ::memset(xuehao2, 0, sizeof(xuehao2));
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    rectangle(550, 120, 870, 170);//學生學號輸入視窗
    rectangle(920, 120, 1020, 170);
    rectangle(0, 0, 100, 50);
    rectangle(500, 300, 950, 350);//1
    rectangle(500, 400, 950, 450);//2
    rectangle(500, 500, 950, 550);//3
    rectangle(500, 600, 950, 650);//4
    rectangle(500, 700, 950, 750);//5
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(360, 40, L"修改學生處分");

    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(350, 120, L"學生學號:");
    outtextxy(350, 200, L"學生資訊:");
    outtextxy(930, 125, L"確定");
    for (int i = 300; i <= 700; i += 100)
    {
        outtextxy(300, i, L"處分資訊:");
    }
    outtextxy(5, 5, L"返回");

    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg == WM_LBUTTONUP)
        {
            Pteacher(tea);
        }
        else if (mg.x > 550 && mg.x < 870 && mg.y>120 && mg.y < 170 && mg.uMsg == WM_LBUTTONUP)//學號輸入框
        {
            setbkcolor(getpixel(601, 201));
            clearrectangle(550, 120, 870, 170);
            rectangle(550, 120, 870, 170);
            InputBox(xuehao, 13, L"請輸入正確的學生學號哦(* ̄3 ̄)╭");
            WideCharToMultiByte(CP_ACP, 0, xuehao, -1, xuehao2, wcslen(xuehao) * 2 + 1, NULL, NULL);
            outtextxy(560, 130, xuehao);
        }
        else if (mg.y > 120 && mg.y < 170 && mg.x > 920 && mg.x < 1020 && mg.uMsg == WM_LBUTTONUP)//確認按鈕
        {
            if (*xuehao2 != '\0')
            {
                temp = find_stuID(L1, xuehao2);
                if (temp)
                {
                    outtextxy(550, 200, CString(temp->Data.name));
                    for (int i = 0, j = 305; i < 5; ++i, j += 100)
                    {
                        outtextxy(510, j, CString(temp->Data.cfxinxi.name[i]));
                    }
                }
                else
                MessageBox(HD, L"未找到該學號=_=", L"查詢學生資訊", MB_OK);
            }
            else
                MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.y > 300 && mg.y < 350 && mg.x > 500 && mg.x < 950 && mg.uMsg == WM_LBUTTONUP)//1
        {
            if (*xuehao2)
            {
                if (temp)
                {
                    setbkcolor(getpixel(501, 301));
                    clearrectangle(500, 300, 950, 350);
                    rectangle(500, 300, 950, 350);
                    InputBox(key1, 20, L"請輸入學生處分資訊");
                    WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                    outtextxy(505, 305, key1);
                    strcpy(temp->Data.cfxinxi.name[0], key2);
                    temp->Data.cfxinxi.loc = 1;
                    save1(L1);
                }
                else
                    MessageBox(HD, L"未找到該學號", L"查詢學生資訊", MB_OK);
            }
            else
                MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.y > 400 && mg.y < 450 && mg.x > 500 && mg.x < 950 && mg.uMsg == WM_LBUTTONUP)//2
        {
            if (*xuehao2)
            {
                if (temp)
                {
                    setbkcolor(getpixel(501, 401));
                    clearrectangle(500, 400, 950, 450);
                    rectangle(500, 400, 950, 450);
                    InputBox(key1, 20, L"請輸入學生處分資訊");
                    WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                    outtextxy(505, 405, key1);
                    strcpy(temp->Data.cfxinxi.name[1], key2);
                    temp->Data.cfxinxi.loc = 2;
                    save1(L1);
                }
                else
                    MessageBox(HD, L"未找到該學號=_=", L"查詢學生資訊", MB_OK);
            }
            else
                MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.y > 500 && mg.y < 550 && mg.x > 500 && mg.x < 950 && mg.uMsg == WM_LBUTTONUP)//3
        {
            if (*xuehao2)
            {
                if (temp)
                {
                    setbkcolor(getpixel(501, 501));
                    clearrectangle(500, 500, 950, 550);
                    rectangle(500, 500, 950, 550);
                    InputBox(key1, 20, L"請輸入學生處分資訊");
                    WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                    outtextxy(505, 505, key1);
                    strcpy(temp->Data.cfxinxi.name[2], key2);
                    temp->Data.cfxinxi.loc = 3;
                    save1(L1);
                }
                else
                    MessageBox(HD, L"未找到該學號=_=", L"查詢學生資訊", MB_OK);
            }
            else
                MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.y > 600 && mg.y < 650 && mg.x > 500 && mg.x < 950 && mg.uMsg == WM_LBUTTONUP)//4
        {
            if (*xuehao2)
            {
                if (temp)
                {
                    setbkcolor(getpixel(501, 601));
                    clearrectangle(500, 600, 950, 650);
                    rectangle(500, 600, 950, 650);
                    InputBox(key1, 20, L"請輸入學生處分資訊");
                    WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                    outtextxy(505, 605, key1);
                    strcpy(temp->Data.cfxinxi.name[3], key2);
                    temp->Data.cfxinxi.loc = 4;
                    save1(L1);
                }
                else
                    MessageBox(HD, L"未找到該學號=_=", L"查詢學生資訊", MB_OK);
            }
            else
                MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
        else if (mg.y > 700 && mg.y < 750 && mg.x > 500 && mg.x < 950 && mg.uMsg == WM_LBUTTONUP)//5
        {
            if (xuehao2)
            {
                if (temp)
                {
                    setbkcolor(getpixel(501, 701));
                    clearrectangle(500, 700, 950, 750);
                    rectangle(500, 700, 950, 750);
                    InputBox(key1, 20, L"請輸入學生處分資訊");
                    WideCharToMultiByte(CP_ACP, 0, key1, -1, key2, wcslen(key1) * 2 + 1, NULL, NULL);
                    outtextxy(505, 705, key1);
                    strcpy(temp->Data.cfxinxi.name[4], key2);
                    temp->Data.cfxinxi.loc = 5;
                    save1(L1);
                }
                else
                    MessageBox(HD, L"未找到該學號=_=", L"查詢學生資訊", MB_OK);
            }
            else
                MessageBox(HD, L"請先輸入學號(>﹏<)", L"查詢學生資訊", MB_OK);
        }
    }
}
void Plog()//登入介面
{
    cleardevice();
    
    IMAGE pmain;//登入註冊介面
    IMAGE tp;
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(360, 200, L"西柚資訊管理登陸");
    rectangle(520, 360, 850, 410);
    rectangle(520, 450, 850, 500);
    rectangle(520, 540, 850, 590);
    rectangle(0, 0, 100, 50);
    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(420, 365, L"學號:");
    outtextxy(420, 455, L"密碼:");
    outtextxy(640, 545, L"登入");
    outtextxy(5, 5, L"返回");
    MOUSEMSG mg;
    student* stu = (student*)malloc(sizeof(student));
    teacher* tea = (teacher*)malloc(sizeof(teacher));
    wchar_t xuehao[20];
    ::memset(xuehao, 0, sizeof(xuehao));
    wchar_t mima[20];
    ::memset(mima, 0, sizeof(mima));
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50 && mg.uMsg== WM_LBUTTONUP)//返回主介面
        {
            PMAIN();
        }
        else if (mg.x > 520 && mg.x < 850 && mg.y>360 && mg.y < 410&&mg.uMsg== WM_LBUTTONUP)//學號輸入
        {
            setbkcolor(getpixel(521,361));
            clearrectangle(520, 360, 850, 410);
            rectangle(520, 360, 850, 410);
            InputBox(xuehao, 13, L"請輸入學號");
            WideCharToMultiByte(CP_ACP, 0, xuehao, -1, stu->Data.ID, wcslen(xuehao)*2 + 1, NULL, NULL);
            WideCharToMultiByte(CP_ACP, 0, xuehao, -1, tea->Data.ID, wcslen(xuehao)*2 + 1, NULL, NULL);
            outtextxy(525, 365, xuehao);
        }
        else if (mg.x > 520 && mg.x < 850 && mg.y>450 && mg.y < 500&&mg.uMsg== WM_LBUTTONUP)//密碼輸入
        {
            setbkcolor(getpixel(521, 451));
            clearrectangle(520, 450, 850, 500);
            rectangle(520, 450, 850, 500);
            InputBox(mima, 13, L"請輸入密碼");
            WideCharToMultiByte(CP_ACP, 0, mima, -1, stu->Data.mima, wcslen(mima)*2 + 1, NULL, NULL);
            WideCharToMultiByte(CP_ACP, 0, mima, -1, tea->Data.mima, wcslen(mima)*2 + 1, NULL, NULL);
            outtextxy(525, 460, mima);
        }
        else if (mg.x > 520 && mg.x < 850 && mg.y>540 && mg.y < 590 && mg.uMsg== WM_LBUTTONUP)//登入
        {
            
            int flag = find_ID(stu, tea, L1, L2);
            if (flag)
            {

                if (flag == 1)//學生賬號
                {
                    student* k1 = NULL;
                    k1 = find_student(stu, L1);
                    outtextxy(520, 700, L"學生登入成功");
                    Sleep(1000);
                    Pstudent(k1);
                }
                else if(flag==2)//老師賬號
                {
                    teacher* k2 = NULL;
                    k2 = find_teacher(tea,L2);
                    outtextxy(560, 700, L"老師登入成功");
                    Sleep(100);
                    Pteacher(k2);
                }
                else if (flag == -1)//學生密碼錯誤
                {
                    MessageBox(HD, L"密碼錯誤,請重新輸入", L"登入資訊",MB_OK);
                }
                else if (flag == -2)//學生密碼錯誤
                {
                    MessageBox(HD, L"密碼錯誤,請重新輸入", L"登入資訊", MB_OK);
                }
            }
            else
            {
                MessageBox(HD, L"此賬號並不存在", L"登入資訊",MB_OK);
            }
        }
        
    }
}
void PMAIN()//主介面,初始介面
{
    cleardevice();
    IMAGE pmain;//登入註冊介面
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(360, 200, L"西柚資訊管理登陸");
    rectangle(520, 360, 690, 410);
    rectangle(520, 450, 690, 500);
    rectangle(1100, 750, 1199, 799);
    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(565, 365, L"登入");
    outtextxy(565, 455, L"註冊");
    outtextxy(1110, 755, L"退出");
    MOUSEMSG mg;
    while (1)
    {
        mg = GetMouseMsg();
        if (mg.x > 520 && mg.x < 690)
        {
            if (mg.y > 360 && mg.y < 410 && mg.uMsg== WM_LBUTTONUP)//登入
            {
                Plog();
            }
            else if (mg.y > 450 && mg.y < 500 && mg.uMsg== WM_LBUTTONUP)//註冊
            {
                Pregister();
            }
        }
        else if (mg.x > 1100 && mg.x < 1200 && mg.y>750 && mg.y < 800 && mg.uMsg == WM_LBUTTONUP)
        {
            exit(0);
        }
    }
}
void Pregister()//註冊介面
{
    cleardevice();
    IMAGE pmain;//登入註冊介面
    loadimage(&pmain, L"PMAIN.jpg", X, Y);
    putimage(0, 0, &pmain);
    setbkmode(TRANSPARENT);
    settextstyle(50, 30, L"微軟雅黑");
    outtextxy(350, 50, L"西柚資訊管理登陸");
    rectangle(520, 120, 850, 180);//賬號框
    rectangle(520, 220, 850, 280);//密碼框
    rectangle(520, 320, 850, 380);//姓名框
    rectangle(320, 420, 490, 480);//學生註冊框
    rectangle(720, 420, 890, 480);//教師註冊框
    rectangle(0, 0, 100, 50);
    settextstyle(40, 20, L"微軟雅黑");
    outtextxy(5, 5, L"返回");
    settextstyle(30, 18, L"微軟雅黑");
    outtextxy(420, 130, L"賬號");
    outtextxy(420, 230, L"密碼");
    outtextxy(420, 330, L"姓名");
    outtextxy(330, 430, L"學生註冊");
    outtextxy(730, 430, L"教師註冊");
    student* stu = (student*)malloc(sizeof(student));
    teacher* tea = (teacher*)malloc(sizeof(student));
    stu->Data.cfxinxi.loc = 0;
    stu->Data.hjxinxi.loc = 0;
    ::memset(stu, 0, sizeof(student));
    ::memset(tea, 0, sizeof(teacher));
    MOUSEMSG mg;
    wchar_t zhanghao[20];
    wchar_t mima[20];
    wchar_t mingzi[20];
    while (1)
    {
        mg=GetMouseMsg();
        if (mg.x > 520 && mg.x < 850)
        {
            if (mg.y > 120 && mg.y < 180 && mg.uMsg == WM_LBUTTONUP)//賬號
            {
                setbkcolor(getpixel(521,121));
                clearrectangle(520, 120, 850, 180);
                rectangle(520, 120, 850, 180);
                InputBox(zhanghao, 13, L"請輸入賬號/學號");
                outtextxy(530, 130, zhanghao);
                WideCharToMultiByte(CP_ACP, 0, zhanghao, -1, stu->Data.ID, wcslen(zhanghao)*2 + 1, NULL, NULL);
                WideCharToMultiByte(CP_ACP, 0, zhanghao, -1, tea->Data.ID, wcslen(zhanghao)*2 + 1, NULL, NULL);
            }
            else if (mg.y > 220 && mg.y < 280 && mg.uMsg == WM_LBUTTONUP)//密碼
            {
                setbkcolor(getpixel(521, 221));
                clearrectangle(520, 220, 850, 280);
                rectangle(520, 220, 850, 280);
                InputBox(mima, 13, L"請輸入密碼");
                outtextxy(530, 230, mima);
                WideCharToMultiByte(CP_ACP, 0, mima, -1, stu->Data.mima, wcslen(mima)*2 + 1, NULL, NULL);
                WideCharToMultiByte(CP_ACP, 0, mima, -1, tea->Data.mima, wcslen(mima)*2 + 1, NULL, NULL);
            }
            else if (mg.y > 320 && mg.y < 380 && mg.uMsg == WM_LBUTTONUP)//姓名
            {
                setbkcolor(getpixel(521, 321));
                clearrectangle(520, 320, 850, 380);
                rectangle(520, 320, 850, 380);
                InputBox(mingzi, 13, L"請輸入姓名");
                outtextxy(530, 330, mingzi);
                WideCharToMultiByte(CP_ACP, 0, mingzi, -1, stu->Data.name, wcslen(mingzi)*2 + 1, NULL, NULL);
                WideCharToMultiByte(CP_ACP, 0, mingzi, -1, tea->Data.name, wcslen(mingzi)*2 + 1, NULL, NULL);
            }    
        }
        else if (mg.y > 420 && mg.y < 480)//註冊
        {

            if (mg.x > 320 && mg.x < 490 && mg.uMsg == WM_LBUTTONUP)
            {
                if (*stu->Data.ID=='\0')
                {
                    MessageBox(HD, L"請先輸入學號", L"註冊資訊", MB_OK);
                }
                else if (*stu->Data.mima=='\0')
                {
                    MessageBox(HD, L"請先輸入密碼", L"註冊資訊", MB_OK);
                }
                else if (*stu->Data.name == '\0')
                {
                    MessageBox(HD, L"請先輸入姓名", L"註冊資訊", MB_OK);
                }
                else
                {
                    int flag = find_ID(stu, tea, L1, L2);
                    if (!flag)
                    {
                        chufen* chuf = (chufen*)malloc(sizeof(chufen));
                        ::memset(chuf, 0, sizeof(chuf));
                        ::memset(chuf->name, 0, sizeof(chuf->name));
                        chuf->loc = 1;
                        strcpy_s(chuf->name[0], "暫無處分");
                        add_chufen(chuf, stu);

                        huojiang huoj;
                        ::memset(&huoj, 0, sizeof(huoj));
                        ::memset(huoj.name, 0, sizeof(huoj.name));
                        huoj.loc = 1;
                        strcpy_s(huoj.name[0], "暫無獲獎");
                        add_huojiang(&huoj, stu);
                        ::memset(&stu->Data.all_kemu, 0, sizeof(stu->Data.all_kemu));
                        stu->Data.all_kemu.score = stu->Data.all_kemu.yuwen = stu->Data.all_kemu.shuxue = stu->Data.all_kemu.yingyu = stu->Data.all_kemu.wuli = stu->Data.all_kemu.huaxue = stu->Data.all_kemu.Cyuyan = 0;
                        stu->Data.qiandao = 0;
                        stu->Data.lastqiandao = 0;

                        ::memset(stu->Data.kebiao, 0, sizeof(stu->Data.kebiao));
                        L1 = add_stu(stu, L1);
                        save1(L1);
                        MessageBox(HD, L"學生註冊成功", L"註冊資訊", MB_OK);
                        PMAIN();
                    }
                    else
                    {
                        MessageBox(HD, L"該學號已經註冊過", L"註冊資訊", MB_OK);
                    }
                }
            }
            else if (mg.x > 720 && mg.x < 890 && mg.uMsg == WM_LBUTTONUP)
            {
                int flag = find_ID(stu, tea, L1, L2);
                if (!flag)
                {
                    L2 = add_tea(tea, L2);
                    save2(L2);
                    MessageBox(HD, L"教師註冊成功", L"註冊資訊", MB_OK);
                    PMAIN();
                }
            }
        }
        else if (mg.x > 0 && mg.x < 100 && mg.y>0 && mg.y < 50&&mg.uMsg== WM_LBUTTONUP)
        {
            PMAIN();
        }
    }
}
int find_ID(student* p1, teacher* p2,List1* L_1, List2* L_2)
{
    class student* pp1 = L_1->head;
    class teacher* pp2 = L_2->head;
    while (pp1)//查詢ID是否是學生
    {
        if (!strcmp(pp1->Data.ID, p1->Data.ID))
        {
            if (!strcmp(pp1->Data.mima, p1->Data.mima))
                return 1;//是學生返回1
            else
                return -1;//密碼錯誤
        }
        pp1 = pp1->next;
    }
    while (pp2)//查詢是不是老師
    {
        if (!strcmp(pp2->Data.ID, p2->Data.ID))
        {
            if (!strcmp(pp2->Data.mima, p2->Data.mima))
                return 2;//是老師返回2
            else
                return -1;//老師密碼錯誤
        }
        pp2 = pp2->next;
    }
    return 0;//並不存在這個賬號
}
student* find_student(student* stu, List1* L)//建立在已經找到學生資訊的情況下,把該學生的位置傳出去
{
    student* p = L->head;
    while (p->next)
    {
        if (!strcmp(p->Data.ID, stu->Data.ID))
            return p;
        p = p->next;
    }
    return p;
}
teacher* find_teacher(teacher* tea, List2* L)//建立在已經找到老師資訊的情況下,把該老師的位置傳出去
{
    teacher* p = L->head;
    while (p->next)
    {
        if (!strcmp(p->Data.ID, tea->Data.ID))
            return p;
        p = p->next;
    }
    return p;
}
student* find_stuID(List1* L, char* num)//尋找num學號的學生
{
    student* p = L->head;
    while (p)
    {
        if (!strcmp(p->Data.ID, num))
            return p;
        p = p->next;
    }
    return NULL;
}
View Code

想體驗的話,可以到我的github檔案裡面下載那個rar,下載後安裝就行。(檔案所需要的素材也都在那裡面)

https://github.com/MangataTS/-just-play-play

如果有不明白的請私信我,或者新增我的QQ:1196991321