學生管理系統(C語言)(Easy-x)

? ? ?

????????????????????????????????????????????????? ????????課 程? 名 稱:? ???程序設計實踐?? ?? ? ? ? ?

????????????????????????????????????????????????? ????????專 ????XXXXX XXXXX ????? ? ?

????????????????????????????????????????????????? ????????學 ???? XXX? ??????????????????????? ??

????????????????????????????????????????????????? ????????學? ?????號 ???? 231040700302?? ???????????

????????????????????????????????????????????????? ????????任 ????XXX ????????????????????????? ?

????????????????????????????????????????????????? ????????學?????? 期 :XXXX-XXXX學年第X學期 ??

????????????????????????????????????????????????????????課程報告任務書

?

學生成績管理系統

主要

內容

用C語言開發一個簡單的學生成績管理系統。實現學生信息管理,并且有界面和跳轉。
【數據結構】
1.學生成績信息。包括:學號,姓名,成績。
2.登陸賬號信息。包括:密碼、 權限級別(區別系統管理員用戶和普通用戶)。
3.學生個人信息。包括:學號,姓名,性別,學院,專業,聯系方式。
【系統實現功能】
1.系統登陸
? 使用登陸賬號和密碼登陸,判斷用戶編號和密碼是否一致,正確,則根據角色不同顯示不同的界面。管理員顯示管理員菜單。普通用戶顯示普通用戶界面。
2.系統管理員
(1)學生信息管理:學生信息和成績的增、刪、改、查功能。
(2)全部展示所有學生的信息和成績在一個交互界面上。
3. 普通用戶(學生)
(1)學生可以注冊自己的個人信息。
(2)學生可以根據自己的學號查詢自己的個人信息和成績。

任務

要求

一、提交材料應包括:

(1)系統源代碼

(2)課程報告

二、整個設計過程具體要求

(1)需求分析

要求學生對案例系統進行分析,設計出需要完成的功能,完善各個模塊的調用關系;要有系統結構圖

(2)設計過程

要求學生進一步明確各模塊調用關系,進一步完善模塊函數細節(函數名、參數、返回值等),至少有一個關鍵模塊的流程圖。

(3)實現過程

要求學生養成良好的編碼習慣、完成各個模塊并進行測試,最終完成系統整體測試;

(4)總結階段

按照要求完成系統設計和實現報告,并進行總結。

?

目錄

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

二、概要設計.......................................... 3

三、詳細設計. .........................................4

(一)函數變量名的定義.................. 4

(二)功能函數模塊展示. .................6

(三)主函數.................................... 6

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

(五)管理員.................................... 8

(六)首頁學分表............................. 9

(七)次頁學分表. ..........................12

(八)尾頁學分表. ..........................13

(九)首頁學生信息表................... .14

(十)次頁學生信息表................... .16

(十一)尾頁學生信息表.................18

(十二)對學生數據進行操作. ........19

(十三)錄入學生信息.................... 20

(十四)刪除學生信息.....................29

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

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

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

(十八)載入學生數目. ...................46

(十九)存儲學生數目.....................46

(二十)學生注冊. .................... .....46

(二十一)學生登錄..................... .. 52

四、調試分析..................... ....................55

五、測試結果..................... ....................55

六、課程心得總結. .................... ............61

七、參考文獻. .................... ...................61

一、需求分析

學生基本信息和學生學分信息動態化綁定,管理員與學生操作相結合的學生信息管理系統,與此同時豐富了一些界面的跳轉和防止用戶錯誤輸入的提醒。

二、概要設計

總覽流程圖,如圖1-1所示,進入首頁后,可以選擇進入管理員界面或者學生操作界面。進入管理員界面后,可以選擇所有學生的數據或者對他們的數據進行增刪查改。進入學生操作界面后,可以選擇學生登錄和學生注冊。

圖1-1 總流程圖

管理員展示流程圖,如圖2-1所示,進入管理員界面后,可以顯示所有學生的學分表和信息表,也可以對他們的數據進行增加,刪除,修改,查詢的操作。

圖2-1 管理員流程圖

學生界面流程圖,如圖3-1所示,進入學生界面,可以選擇學生登錄或者注冊,如果你登錄沒有注冊的學號信息的話,會跳轉到注冊頁面去完成相應的注冊操作。

圖3-1 學生流程圖

三、詳細設計

(一)函數變量名的定義

#include <stdio.h>

#include<stdlib.h>

#include<string.h>

#include<graphics.h>

#define RecordNums 42//結構體數組數量——可以記錄學生數據最大容量

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

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

#define Transverse_s 145//學分表格橫向

#define longitudinal_s 39//學分表格縱向

typedef struct Student//學生信息結構體定義

{

??? char s_studentID[15];//學號

??? char s_Name[15];//姓名

??? char s_gender[15];//性別

??? char s_faculty[15];//院系

??? char s_speciality[15];//專業

??? char s_grade[15];//年級

??? char s_number[15];//手機號

}Student;

typedef struct Score//學生學分結構體定義

{

??? char studentID[15];//學號

??? char Name[15];//姓名

??? char compulsory[6];//必修

??? char select[6];//選修

??? char morality[6];//德育

??? char innovate[6];//創新

??? char other[6];//其它

??? char sum[6];//總和

}Score;

typedef struct app//學生信息緩沖結構體

{

??? char s_studentID[15];//學號

??? char s_Name[15];//姓名

??? char s_gender[15];//性別

? ??char s_faculty[15];//院系

??? char s_speciality[15];//專業

??? char s_grade[15];//年級

??? char s_number[15];//手機號

}app;

typedef struct add//學生學分緩沖結構體

{

??? char studentID[15];//學號

??? char Name[15];//姓名

??? char compulsory[6];//必修

??? char select[6];//選修

? ??char morality[6];//德育

??? char innovate[6];//創新

??? char other[6];//其它

??? char sum[6];//總和

}add;

(二)功能函數模塊展示

void main();//主窗口

void password();//管理員認證

void managewindows();//管理員

void summary();//對學生數據進行操作

void information_homepage();//首頁學生信息表

void information_secondarypage();//次頁學生信息表

void credit_homepage();//首頁學分表

void credit_secondarypage();//次頁學分表

void information_secondarypage_final();//尾頁學生信息表

void credit_secondarypage_final();//尾頁學生學分表

void increase();//錄入學生信息

void erasure();//刪除學生信息

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

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

void studentwindows();//學生窗口

void student_registration();//學生注冊

void student_login();// 學生登錄

(三)主函數

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

{

??? initgraph(1280, 720);

??? IMAGE host_a;

??? loadimage(&host_a, "E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\界面圖片\\首頁.png", 1280,720);

??? HWND hnd = GetHWnd();

??? SetWindowText(hnd, "學生信息管理系統");

??? putimage(0, 0, &host_a);

??? settextcolor(WHITE);//設置字體顏色為白色

??? setbkmode(TRANSPARENT);//消除字體背景顏色

??? settextstyle(40,0,_T("Consolas"));//設置字體大小

??? while (1)//時刻獲取鼠標信息

? ??{

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

??????? {

??????????? MOUSEMSG host_b = GetMouseMsg();//設置變量引入消息

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

??????????? {

??????????? case WM_LBUTTONDOWN://左鍵

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

??????????????? {

????????? ??????????password();//進入管理員界面

??????????????????? break;

??????????????? }

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

????????? ??????{

??????????????????? studentwindows();//進入學生界面

?????????? ?????????break;

??????????????? }

??????????? }

??????? }

??? }

}

全局變量:

int nowstudentnums=0;//學生信息數據個數

//int num = 0;//統計學生人數

char code[20] = "666666";//管理員密碼

int interdict=0;//阻斷循環變量

Student information[RecordNums];//創建學生信息結構體數組

Score credit[RecordNums];//創建學生學分結構體數組

app information_buffer;//創建學生信息緩沖結構體

add credit_buffer;//創建學生學分緩沖結構體

(四)管理員界面

void password()//管理員認證

{

??? char password_a[15];

??? TCHAR password_s[] = _T("輸入管理員密碼");

? ??InputBox(password_a, 15, password_s);

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

??? {

??????? managewindows();

??? }

??? else

??? {

??????? HWND hnd = GetHWnd();

??????? int isok=MessageBox(hnd, "輸入密碼錯誤,請重新輸入", "錯誤提示", MB_OKCANCEL);

??????? if (isok == IDOK)

????? ??{

??????????? password();

??????? }

??????? else if (IDCANCEL == isok)

??????? {

??????????? main();

??????? }

??? }

}

(五)管理員

void managewindows()//管理員

{

??? IMAGE manage_a;

??? loadimage(&manage_a, "E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\界面圖片\\管理員操作界面.png", 1280,720);

??? putimage(0, 0, &manage_a);

??? FILE* informationfile_s;//定義存取學生信息文件指針

??? FILE* creditfile_s;//定義存取學分信息文件指針

??? //打開文檔進行分析操作

??? informationfile_s = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生信息.txt", "r+");

??? creditfile_s = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生學分.txt", "r+");

??? //提取學生學分數據

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

??? {

??????? //判斷數據是否讀完

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

??????? {

??????????? break;

??????? }

??????? //將文件數據保存在結構數組中

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

??????????? information[i].s_studentID,

??????????? information[i].s_Name,

??????????? information[i].s_gender,

??????????? information[i].s_faculty,

??????????? information[i].s_speciality,

?????? ?????information[i].s_grade,

??????????? information[i].s_number);

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

??????????? credit[i].studentID,

??????????? credit[i].Name,

??????????? credit[i].compulsory,

??????????? credit[i].select,

????? ??????credit[i].morality,

?? ?????????credit[i].innovate,

??????????? credit[i].other,

??????????? credit[i].sum);

??? }

??? fclose(informationfile_s);//關閉文件

??? fclose(creditfile_s);//關閉文件

??? while (1)//時刻獲取鼠標信息

??? {

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

?? ?????{

??????????? MOUSEMSG manage_b = GetMouseMsg();//設置變量引入消息

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

??????????? {

??????????? case WM_LBUTTONDOWN://左鍵

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

?????????????? ?{

??????????????????? credit_homepage();//首頁學分表

??????????????????? break;

??????????????? }

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

??????????????? {

????? ??????????????summary();//對學生數據進行操作

??????????????????? break;

??????????????? }

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

??????????????? {

??????????????????? main();//主窗口

????????????? ??????break;

??????????????? }

??????????

??????????? }

??????? }

??? }

}

(六)首頁學分表

void credit_homepage()//首頁學分表

{

??? IMAGE creditpicture_s;//定義界面圖片指針

??? loadimage(&creditpicture_s, "E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\界面圖片\\首頁學生學分表.png", 1280, 720);

??? putimage(0, 0, &creditpicture_s);

??? settextstyle(25, 0, _T("Consolas"));//設置字體大小

??? settextcolor(BLACK);//設置字體顏色為黑色

??? setbkmode(TRANSPARENT);//消除字體背景顏色

??? //冒泡排序法——總分排序

??? int i = 0, j;

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

??? {

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

??????? {

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

??????????? {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

??????????? }

??????? }

?? ?}

??? //輸出數據

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

??? {

??????? //將結構數組中數據輸出到主表格

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

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

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

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

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

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

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

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

??? }

??? //按鍵的響應

??? while (1)//時刻獲取鼠標信息

??? {

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

??????? {

??????????? MOUSEMSG credit_s = GetMouseMsg();//設置變量引入消息

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

??????????? {

??????????? case WM_LBUTTONDOWN://左鍵

??????????????? //(返回)按鈕

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

??????????????? {

??????????????????? managewindows();//管理員界面

??????????????????? break;

??????????????? }

????????? ??????//(顯示學生基本信息)按鈕

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

??????????????? {

??????????????????? information_homepage();//首頁學生信息表

??????????????????? break;

??????????????? }

??? ????????????//(下一頁)按鈕

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

??????????????? {

??????????????????? credit_secondarypage();//次頁學分表

??????????????????? break;

??????????????? }

???? ???????}

??????? }

??? }

}

(七)次頁學分表

void credit_secondarypage()//次頁學分表

{

??? IMAGE creditpicture_c;//定義界面圖片指針

??? loadimage(&creditpicture_c, "E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\界面圖片\\次頁學生學分表.png", 1280, 720);

??? putimage(0, 0, &creditpicture_c);

??? settextstyle(25, 0, _T("Consolas"));//設置字體大小

??? settextcolor(WHITE);//設置字體顏色為白色

??? setbkmode(TRANSPARENT);//消除字體背景顏色

??? int a = 0;

??? //輸出數據

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

??? {

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

??????? {

??????????? break;

??????? }

??????? //將結構數組中數據輸出到主表格

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

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

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

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

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

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

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

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

??????? a++;

??? }

??? //按鍵的響應

??? while (1)//時刻獲取鼠標信息

??? {

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

??????? {

??????????? MOUSEMSG credit_c = GetMouseMsg();//設置變量引入消息

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

??????????? {

??????????? case WM_LBUTTONDOWN://左鍵

??????????????? //(上一頁)按鈕

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

??????????????? {

??????????????????? credit_homepage();//首頁學分表

??????????????????? break;

??????????????? }

??????????????? //(下一頁)按鈕

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

??????????????? {

??????????????????? credit_secondarypage_final();//尾頁學生學分表

??????????????????? break;

??????????????? }

??????????? }

??????? }

? ??}

}

(八)尾頁學分表

void credit_secondarypage_final()//尾頁學生學分表

{

??? IMAGE creditpicture_w;//定義界面圖片指針

??? loadimage(&creditpicture_w, "E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\界面圖片\\尾頁學生學分表.png", 1280, 720);

??? putimage(0, 0, &creditpicture_w);

??? settextstyle(25, 0, _T("Consolas"));//設置字體大小

??? settextcolor(BLACK);//設置字體顏色為黑色

??? setbkmode(TRANSPARENT);//消除字體背景顏色

??? int a = 0;

??? //輸出數據

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

??? {

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

??????? {

??????????? break;

??????? }

???? ???//將結構數組中數據輸出到主表格

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

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

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

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

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

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

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

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

??????? a++;

? ??}

??? //按鍵的響應

??? while (1)//時刻獲取鼠標信息

??? {

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

??????? {

??????????? MOUSEMSG credit_w = GetMouseMsg();//設置變量引入消息

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

??????????? {

??????????? case WM_LBUTTONDOWN://左鍵

??????????????? //(上一頁)按鈕

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

??????????????? {

??????????????????? credit_secondarypage();//次頁學分表

??????????????????? break;

??????????????? }

???? ???????}

??????? }

??? }

}

(九)首頁學生信息表

void information_homepage()//首頁學生信息表

{

??? IMAGE informationpicture_s;//定義界面圖片指針

??? loadimage(&informationpicture_s, "E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\界面圖片\\首頁學生信息表.png", 1280, 720);

??? putimage(0, 0, &informationpicture_s);

??? settextstyle(25, 0, _T("Consolas"));//設置字體大小

??? settextcolor(BLACK);//設置字體顏色為黑色

??? setbkmode(TRANSPARENT);//消除字體背景顏色

???? UseStudentNumber();//載入學生數目

??? //冒泡排序法——學號排序

??? int i = 0, j;

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

??? {

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

??????? {

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

??????????? {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

??????????? }

??????? }

??? }

??? //輸出數據

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

??? {

??????? //將結構數組中數據輸出到表格

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

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

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

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

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

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

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

??? }

??? //按鍵的響應

??? while (1)//時刻獲取鼠標信息

??? {

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

??????? {

??????????? MOUSEMSG information_s = GetMouseMsg();//設置變量引入消息

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

??????????? {

??????????? case WM_LBUTTONDOWN://左鍵

?????????????? ?//(返回)按鈕

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

??????????????? {

??????????????????? managewindows();//管理員界面

??????????????????? break;

??????????????? }

????????? ??????//(顯示學分)按鈕

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

??????????????? {

?????????????????? ?credit_homepage();//首頁學分表

??????????????????? break;

????????????? ??}

??????????????? //(下一頁)按鈕

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

??????????????? {

?? ?????????????????information_secondarypage();//次頁學生信息表

???????????? ???????break;

??????????????? }

??????????? }

??????? }

??? }

}

(十)次頁學生信息表

void information_secondarypage()//次頁學生信息表

{

??? IMAGE informationpicture_c;//定義界面圖片指針

??? loadimage(&informationpicture_c, "E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\界面圖片\\次頁學生信息表.png", 1280, 720);

??? putimage(0, 0, &informationpicture_c);

??? settextstyle(25, 0, _T("Consolas"));//設置字體大小

??? settextcolor(BLACK);//設置字體顏色為黑色

??? setbkmode(TRANSPARENT);//消除字體背景顏色

??? int b=0;

??? //輸出數據

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

??? {

??????? //將結構數組中數據輸出到表格

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

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

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

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

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

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

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

??????? b++;

??? }

??? //按鍵的響應

??? while (1)//時刻獲取鼠標信息

??? {

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

??????? {

??????????? MOUSEMSG information_c = GetMouseMsg();//設置變量引入消息

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

??????????? {

??????????? case WM_LBUTTONDOWN://左鍵

?????????????? ?//(上一頁)按鈕

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

??????????????? {

??????????????????? information_homepage();//首頁學生信息表

??????????????????? break;

??????????????? }

??????????????? //(下一頁)按鈕

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

??????????????? {

????? ??????????????information_secondarypage_final();//尾頁學生信息表

????????? ??????????break;

??????????????? }

??????????? }

??????? }

??? }

}

(十一)尾頁學生信息表

void information_secondarypage_final()//尾頁學生信息表

{

??? IMAGE informationpicture_w;//定義界面圖片指針

??? loadimage(&informationpicture_w, "E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\界面圖片\\尾頁學生信息表.png", 1280, 720);

??? putimage(0, 0, &informationpicture_w);

??? settextstyle(25, 0, _T("Consolas"));//設置字體大小

??? settextcolor(BLACK);//設置字體顏色為黑色

??? setbkmode(TRANSPARENT);//消除字體背景顏色

??? int b = 0;

??? //輸出數據

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

??? {

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

??????? {

??????????? break;

??????? }

??????? //將結構數組中數據輸出到表格

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

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

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

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

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

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

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

??????? b++;

??? }

??? //按鍵的響應

??? while (1)//時刻獲取鼠標信息

??? {

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

??????? {

??????????? MOUSEMSG information_w = GetMouseMsg();//設置變量引入消息

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

??????????? {

??????????? case WM_LBUTTONDOWN://左鍵

?????????????? ?//(上一頁)按鈕

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

??????????????? {

??????????????????? information_secondarypage();//次頁學生信息表

??????????????????? break;

??????????? ????}

??????????? }

?????? ?}

??? }

}

(十二)對學生數據進行操作

void summary()//對學生數據進行操作

{

??? IMAGE summary_s;//定義界面圖片指針

??? loadimage(&summary_s, "E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\界面圖片\\增刪查改主界面.png", 1280, 720);

??? putimage(0, 0, &summary_s);

??? //按鍵的響應

??? while (1)//時刻獲取鼠標信息

??? {

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

??????? {

??????????? MOUSEMSG summary_q = GetMouseMsg();//設置變量引入消息

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

??????????? {

??????????? case WM_LBUTTONDOWN://左鍵

??????????????? //(返回)按鈕

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

??????????????? {

??????????????????? managewindows();//管理員

??????????????????? break;

??????????????? }

??????????????? //(錄入學生信息)按鈕

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

??????????????? {

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

??????????????????? {

??????????????????????? int isok = MessageBox(NULL, "數據庫已滿,無法存入數據", "數據輸入", MB_OKCANCEL);//創建提示窗口

??????????????????? }

??????????????????? else

??????????????????? {

??????????????????????? increase();//錄入學生信息

??????????????????????? break;

??????????????????? }

??????????????? }

??????????????? //(刪除學生信息)按鈕

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

??????????????? {

??????????????????? erasure();//刪除學生信息

??????????????????? break;

?????? ?????????}

??????????????? //(查找學生信息)按鈕

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

??????????????? {

??????????????????? view();//查找學生信息

??????????????????? break;

??????????????? }

??????????????? //(修改學生信息)按鈕

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

??????????????? {

??????????????????? correct();//修改學生信息

??????????????????? break;

??????????????? }

??????????

??????????? }

??????? }

??? }

}

(十三)錄入學生信息

void increase()

//錄入學生信息

{

??? IMAGE increase_s;//定義界面圖片指針

??? loadimage(&increase_s, "E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\界面圖片\\錄入學生信息.png", 1280, 720);

??? putimage(0, 0, &increase_s);

??? settextcolor(BLACK);//設置字體顏色為黑色

??? setbkmode(TRANSPARENT);//消除字體背景顏色

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

??? FILE* informationfile_s;//定義存取學生信息文件指針

??? FILE* creditfile_s;//定義存取學分信息文件指針

??? //打開文檔進行分析操作

??? informationfile_s = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生信息.txt", "r+");

??? creditfile_s = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生學分.txt", "r+");

???? UseStudentNumber();//載入學生數目

??? //提取學生學分數據

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

??? {

????? ??//判斷數據是否讀完

??????? if (feof(informationfile_s) == 1)

??????? {

??????????? break;

??????? }

??????? //將文件數據保存在結構數組中

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

??????????? information[i].s_studentID,

??????????? information[i].s_Name,

??????????? information[i].s_gender,

??????????? information[i].s_faculty,

??????????? information[i].s_speciality,

??????????? information[i].s_grade,

??????????? information[i].s_number);

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

??????????? credit[i].studentID,

??????????? credit[i].Name,

??????????? credit[i].compulsory,

??????????? credit[i].select,

??????????? credit[i].morality,

??????????? credit[i].innovate,

??????????? credit[i].other,

??????????? credit[i].sum);

??? }

??? fclose(informationfile_s);//關閉文件

??? fclose(creditfile_s);//關閉文件

??? int accumulation = 0;

??? interdict = 0;

??? //按鍵的響應

??? while (1)//時刻獲取鼠標信息

??? {

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

??????? {

??????????? MOUSEMSG increase_q = GetMouseMsg();//設置變量引入消息

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

??????????? {

??????????? case WM_LBUTTONDOWN://左鍵

??????????????? //(返回)按鈕

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

??????????????? {

??????????????????? summary();//對學生數據進行操作

??????????????????? break;

??????????????? }

??????????????? //(學號)格

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

??????????????? {

??????????????????? TCHAR InputWindow_studentID[] = _T("請輸入該學生的學號");

??????????????????? InputBox(information_buffer.s_studentID, 15, InputWindow_studentID);

??????????????????? //檢測是否重復

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

??????????????????? {

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

??????????????????????? {

??????????????????????????? HWND hnd = GetHWnd();

??????????????????????????? int isok = MessageBox(hnd, "輸入學號重復錯誤,請重新輸入", "錯誤提示", MB_OKCANCEL);

??????????????????????????? if (isok == IDOK)

??????????????????????????? {??

??????????????????????????????? interdict = 1;

??????????????????????????????? break;

??????????????????????????? }

??????????????????????????? else if (IDCANCEL == isok)

????? ??????????????????????{

??????????????????????????????? interdict = 1;

??????????????????????????????? break;

??????????????????????????? }

??????????????????????? }

??????????????????? }

??????????????????? if (interdict == 1)

??????????????????? {

????? ??????????????????continue;

??????????????????? }

??????????????????? //檢測完成——進行屏幕輸出

??????????????????? outtextxy(63.87, 322.86, information_buffer.s_studentID);

??????????????????? //保存在結構數組中

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

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

??????????????????? accumulation += 1;

??????????????? }

? ??????????????//(姓名)格

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

??????????????? {

??????????????????? TCHAR InputWindow_Name[] = _T("請輸入該學生的姓名");

??????? ????????????InputBox(information_buffer.s_Name, 15, InputWindow_Name);

???? ???????????????//進行輸出

??????????????????? outtextxy(255.47, 322.86, information_buffer.s_Name);

??????????????????? //保存在結構數組中

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

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

??????????????????? accumulation += 1;

??????????????? }

??????????????? //(性別)格

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

????? ??????????{

??????????????????? TCHAR InputWindow_gender[] = _T("請輸入該學生的性別");

??????????????????? InputBox(information_buffer.s_gender, 15, InputWindow_gender);

??????????????????? //進行輸出

??????????????????? outtextxy(379.43, 322.86, information_buffer.s_gender);

??????????????????? //保存在結構數組中

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

??????????????????? accumulation += 1;

??????????????? }

??????????????? //(院系)格

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

??????????????? {

??????????????????? TCHAR InputWindow_faculty[] = _T("請輸入該學生的院系全稱");

??????????????????? InputBox(information_buffer.s_faculty, 15, InputWindow_faculty);

??????????????????? //進行輸出

??????????? ????????outtextxy(452.36, 322.86, information_buffer.s_faculty);

??????????????????? //保存在結構數組中

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

??????????????????? accumulation += 1;

??????????????? }

??? ????????????//(專業)格

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

??????????????? {

??????????????????? TCHAR InputWindow_speciality[] = _T("請輸入該學生的專業");

??????????????????? InputBox(information_buffer.s_speciality, 15, InputWindow_speciality);

??????????????????? //進行輸出

??? ????????????????outtextxy(691.59, 322.86, information_buffer.s_speciality);

??????????????????? //保存在結構數組中

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

??????????????????? accumulation += 1;

?????? ?????????}

??????????????? //(年級)格

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

??????????????? {

??????????????????? TCHAR InputWindow_grade[] = _T("請輸入該學生的年級,例(2201)22屆1班");

??????????????????? InputBox(information_buffer.s_grade, 15, InputWindow_grade);

??????????????????? //進行輸出

????????? ??????????outtextxy(865.43, 322.86, information_buffer.s_grade);

??????????????????? //保存在結構數組中

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

??????????????????? accumulation += 1;

??????????????? }

??????? ????????//(手機號)格

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

??????????????? {

??????????????????? TCHAR InputWindow_number[] = _T("請輸入該學生的手機號");

??????????????????? InputBox(information_buffer.s_number, 15, InputWindow_number);

??????????????????? // 進行輸出

??????????????????? outtextxy(987.12, 322.86, information_buffer.s_number);

??????????????????? //保存在結構數組中

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

??????????????????? accumulation += 1;

??????????????? }

??????????????? //(必修)格

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

??????????????? {

????????????????? ??TCHAR InputWimdow_compulsory[] = _T("請輸入該學生的必修");

??????????????????? InputBox(credit_buffer.compulsory, 15, InputWimdow_compulsory);

??????????????????? // 進行輸出

??????????????????? outtextxy(63.87, 464.21, credit_buffer.compulsory);

????????????????? ??//保存在結構數組中

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

??????????????????? accumulation += 1;

??????????????? }

??????????????? //(選修)格

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

??????????????? {

??????????????????? TCHAR InputWimdow_select[] = _T("請輸入該學生的選修");

??????????????????? InputBox(credit_buffer.select, 15, InputWimdow_select);

??????????????????? // 進行輸出

??????????????? ????outtextxy(145, 464, credit_buffer.select);

??????????????????? //保存在結構數組中

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

??????????????????? accumulation += 1;

??????????????? }

??????????????? //(德育)格

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

??????????????? {

??????????????????? TCHAR InputWimdow_morality[] = _T("請輸入該學生的德育");

??????????????????? InputBox(credit_buffer.morality, 15, InputWimdow_morality);

?? ?????????????????// 進行輸出

??????????????????? outtextxy(226, 464, credit_buffer.morality);

??????????????????? //保存在結構數組中

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

??????????????????? accumulation += 1;

?????????? ?????}

??????????????? //(選修)格

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

??????????????? {

??????????????????? TCHAR InputWimdow_select[] = _T("請輸入該學生的選修");

???????? ???????????InputBox(credit_buffer.select, 15, InputWimdow_select);

??????????????????? // 進行輸出

??????????????????? outtextxy(307, 464, credit_buffer.select);

??????????????????? //保存在結構數組中

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

??????????????????? accumulation += 1;

??????????????? }

??????????????? //(創新)格

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

??????????????? {

????????????????? ??TCHAR InputWimdow_innovate[] = _T("請輸入該學生的創新");

??????????????????? InputBox(credit_buffer.innovate, 15, InputWimdow_innovate);

??????????????????? // 進行輸出

??????????????????? outtextxy(307, 464, credit_buffer.innovate);

??????????????????? //保存在結構數組中

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

??????????????????? accumulation += 1;

??????????????? }

??????????????? //(其它)格

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

??????????????? {

??????????????????? TCHAR InputWimdow_other[] = _T("請輸入該學生的其它學分");

??????????????????? InputBox(credit_buffer.other, 15, InputWimdow_other);

??????????????????? // 進行輸出

??????????????????? outtextxy(388, 464, credit_buffer.other);

??????????????????? //保存在結構數組中

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

??????????????????? accumulation += 1;

??????????????? }

??????????????? //(總分)格

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

??????????????? {

??????????????????? //計算總分

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

??????????????????? //賦予數組

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

??????????????????? //進行輸出

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

??????????????????? accumulation += 1;

??????????????? }

??????????????? //(確定)按鈕

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

?????????? ?????{

??????????????????? //如果有一個沒輸入完,就不能保存

??????????????????? if (accumulation !=13)

??????????????????? {

??????????????????????? HWND hnd = GetHWnd();

??????????????????????? int isok = MessageBox(hnd, "數據沒有錄完,請繼續錄入", "錯誤提示", MB_OKCANCEL);

?????????? ?????????????if (isok == IDOK)

??????????????????????? {

??????????????????????????? interdict = 1;

??????????????????????????? continue;

??????????????????????? }

??????????????????????? else if (IDCANCEL == isok)

??????????????????????? {

?????????????? ?????????????interdict = 1;

??????????????????????????? continue;

??????????????????????? }

??????????????????? }

??????????????????? else

??????????????????? {

??????????????????????? FILE* increase_g;//定義輸入信息文件指針

??????????????????????? FILE* increase_l;//定義存取信息文件指針

??????????????????????? //打開文檔進行分析操作

??????????????????????? increase_g = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生信息.txt", "w+");

??????????????????????? increase_l = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生學分.txt", "w+");

??????????????????????????? UseStudentNumber();//載入學生人數

??????????????????????? int y;//循環變量

??????????????????????? //存入學生數據

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

??????????????????????? {

?????????????? ?????????????//判斷數據是否存完

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

??????????????????????????? {

??????????????????????????????? break;

??????????????????????????? }

??????????????????????????? //將結構數據保存在文件中

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

??????????????????????????????? information[y].s_studentID,

??????????????????????????????? information[y].s_Name,

??????????????????????????????? information[y].s_gender,

??????????????????????????? ????information[y].s_faculty,

??????????????????????? ????????information[y].s_speciality,

??????????????????????????????? information[y].s_grade,

??????????????????????????????? information[y].s_number);

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

??????????????????????????????? credit[y].studentID,

??????????????????????????????? credit[y].Name,

??????????????????????????????? credit[y].compulsory,

??????????????????????????????? credit[y].select,

???????????????????????? ???????credit[y].morality,

??????????????????????????????? credit[y].innovate,

??????????????????????????????? credit[y].other,

??????????????????????????????? credit[y].sum);

??????????????????????? }

??????????????????????? fclose(increase_g);//關閉文件

??????????????????????? fclose(increase_l);//關閉文件

??????????????????????? nowstudentnums = nowstudentnums + 1;

??????????????????????????? SaveStudentNumber();//記錄學生人數

??????????????????????? HWND hnd = GetHWnd();

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

??????????????????????? if (isok == IDOK)

??????????????????????? {

??????????????????????????? interdict = 1;

??????????????????????????? continue;

??????????????????????? }

??????????????????????? else if (IDCANCEL == isok)

???? ???????????????????{

??? ????????????????????????interdict = 1;

??????????????????????????? continue;

??????????????????????? }

??????????????????? }

??????????????? }

??????????????? //(再填下一個)按鈕

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

??????????????? {

??????????????????? increase();//錄入學生信息

?????????????????????? UseStudentNumber();//載入學生數目

??????????????? }

??????????? }

??????? }

??? }

}

(十四)刪除學生信息

void erasure()//刪除學生信息

{

??? IMAGE erasure_s;//定義界面圖片指針

??? loadimage(&erasure_s, "E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\界面圖片\\刪除學生信息.png", 1280, 720);

??? putimage(0, 0, &erasure_s);

??? settextcolor(BLACK);//設置字體顏色為黑色

??? setbkmode(TRANSPARENT);//消除字體背景顏色

???? UseStudentNumber();//載入學生數目

??? FILE* informationfile_s;//定義存取學生信息文件指針

??? FILE* creditfile_s;//定義存取學分信息文件指針

??? //打開文檔進行分析操作

??? informationfile_s = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生信息.txt", "r");

??? creditfile_s = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生學分.txt", "r");

??? //提取學生學分數據

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

??? {

??????? //判斷數據是否讀完

??????? if (feof(informationfile_s) == 1)

??????? {

??????????? break;

??????? }

??????? //將文件數據保存在結構數組中

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

??????????? information[i].s_studentID,

??????????? information[i].s_Name,

??????????? information[i].s_gender,

??????????? information[i].s_faculty,

??????????? information[i].s_speciality,

???? ???????information[i].s_grade,

??????????? information[i].s_number);

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

??????????? credit[i].studentID,

??????????? credit[i].Name,

??????????? credit[i].compulsory,

??????????? credit[i].select,

??????????? credit[i].morality,

??????????? credit[i].innovate,

??????????? credit[i].other,

??????????? credit[i].sum);

??? }

??? fclose(informationfile_s);//關閉文件

??? fclose(creditfile_s);//關閉文件

??? int u = 0,k=0;

??? //獲取鼠標操作

??? while (1)//時刻獲取鼠標信息

??? {

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

??????? {

??????????? MOUSEMSG erasure_b = GetMouseMsg();//設置變量引入消息

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

??????????? {

??????????? case WM_LBUTTONDOWN://左鍵

??????????????? //返回按鈕

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

????? ??????????{

??????????????????? summary();//對學生數據進行操作

??????????????????? break;

??????????????? }

??????????????? //學號按鈕

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

??????????????? {

???????? ???????????TCHAR InputWindow_studentID[] = _T("請輸入要刪除學生的學號");

??????????????????? InputBox(information_buffer.s_studentID, 15, InputWindow_studentID);

??????????????????? //定位該生所在位置

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

??????????????????? {

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

??????????????????????? {

??????????????????????????? break;

??????????????????????? }

??????????????????? }

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

???????????? ???????{

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

??????????????????????? {

??????????????????????????? break;

??????????????????????? }

??????????????????? }

??????????????????? if (u == 42)

???????? ???????????{

??????????????????????? HWND mmm = GetHWnd();

?? ?????????????????????int i = MessageBox(mmm, "沒有該學生,無法進行刪除", "錯誤提示", MB_OKCANCEL);

??????????????????????? if (i == IDOK)

??????????????????????? {

??????????????????????????? continue;

??????? ????????????????}

??????????????????????? else if (IDCANCEL == i)

??????????????????????? {

??????????????????????????? continue;

??????????????????????? }

??????????????????? }

??????????????????? //在指定的圖框中顯示

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

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

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

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

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

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

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

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

?????????? ?????}

??????????????? //確定按鈕

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

??????????????? {

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

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

??????????????????? FILE* erasure_g;//定義輸入信息文件指針

??????????????????? FILE* erasure_l;//定義存取信息文件指針

??????????????????? //打開文檔進行分析操作

??????????????????? erasure_g = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生信息.txt", "w+");

??????????????????? erasure_l = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生學分.txt", "w+");

?????????????????????? UseStudentNumber();//載入學生數據

?????????????????????? nowstudentnums = nowstudentnums - 1;//刪除后學生人數減1

??????????????????? int y;//循環變量

??????????????????? //存入學生數據

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

??????????????????? {

??????????????????????? if (y == u)

??????????????????????? {

??????????????????????????? continue;

??????????????????????? }

??????????????????????? //將結構數據保存在文件中

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

??????????????????????????? information[y].s_studentID,

??????????????????????????? information[y].s_Name,

??????????????????????????? information[y].s_gender,

??????????????????????????? information[y].s_faculty,

??????? ????????????????????information[y].s_speciality,

??????????????????????????? information[y].s_grade,

??????????????????????????? information[y].s_number);

??????????????????? }

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

?? ?????????????????{

??????????????????????? if (y == k)

??????????????????????? {

??????????????????????????? continue;

??????????????????????? }

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

??????????????????????????? credit[y].studentID,

??????????????????????????? credit[y].Name,

??????????????????????????? credit[y].compulsory,

??????????????????????????? credit[y].select,

??????????????????????????? credit[y].morality,

??????????????????????????? credit[y].innovate,

?????? ?????????????????????credit[y].other,

??????????????????????????? credit[y].sum);

??????????????????? }

??????????????????? fclose(erasure_g);//關閉文件

??????????????????? fclose(erasure_l);//關閉文件

?????????????????????? //nowstudentnums = nowstudentnums - 1;//刪除后學生人數減1

?????????????????????? SaveStudentNumber();//記錄當前學生人數

??????????????????? //打開文檔進行分析操作

??????????????????? erasure_g = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生信息.txt", "r+");

??????????????????? erasure_l = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生學分.txt", "r+");

????? ??????????????int o;//學生信息數據個數

??????????????????? //提取學生學分數據

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

??????????????????? {

??????????????????????? //判斷數據是否讀完

??????????????????????? if (feof(erasure_g) == 1)

??????????????????????? {

??????????????? ????????????break;

??????????????????????? }

??????????????????????? //將文件數據保存在結構數組中

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

??????????????????????????? information[o].s_studentID,

?? ?????????????????????????information[o].s_Name,

??????????????????????????? information[o].s_gender,

??????????????????????????? information[o].s_faculty,

??????????????????????????? information[o].s_speciality,

??????????????????????????? information[o].s_grade,

??????????????????????????? information[o].s_number);

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

??????????????????????????? credit[o].studentID,

??????????????????????????? credit[o].Name,

??????????????????????????? credit[o].compulsory,

????????????????????? ??????credit[o].select,

??????????????????????????? credit[o].morality,

??????????????????????????? credit[o].innovate,

??????????????????? ????????credit[o].other,

??????????????????????????? credit[o].sum);

??????????????????? }

?? ?????????????????fclose(erasure_g);//關閉文件

??????????????????? fclose(erasure_l);//關閉文件

??????????????????? HWND mmm = GetHWnd();

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

??????????????????? if (i == IDOK)

??????????????? ????{

??????????????? ????????interdict = 1;

??????????????????????? continue;

??????????????????? }

??????????????????? else if (IDCANCEL == i)

??????????????????? {

??????????????????????? interdict = 1;

??????????????????????? continue;

??????????????? ????}

??????????????? }

?????????? ????//再刪下一個按鈕

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

??????????????? {

??????????????????? erasure();//刪除學生信息

?????????????????????? UseStudentNumber();//載入學生數目

???????????????? ???break;

???? ???????????}?

??????????? }

??????? }

??? }

}

(十五)查找學生信息

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

{

???

??? IMAGE view_s;//定義界面圖片指針

??? loadimage(&view_s, "E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\界面圖片\\查詢學生信息.png", 1280, 720);

??? putimage(0, 0, &view_s);

??? settextcolor(BLACK);//設置字體顏色為黑色

??? setbkmode(TRANSPARENT);//消除字體背景顏色

???? UseStudentNumber();//載入學生數目

??? FILE* informationfile_s;//定義存取學生信息文件指針

??? FILE* creditfile_s;//定義存取學分信息文件指針

??? //打開文檔進行分析操作

??? informationfile_s = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生信息.txt", "r+");

??? creditfile_s = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生學分.txt", "r+");

??? //提取學生學分數據

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

??? {

??????? //判斷數據是否讀完

??????? if (feof(informationfile_s) == 1)

??????? {

?? ?????????break;

????? ??}

??????? //將文件數據保存在結構數組中

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

??????????? information[i].s_studentID,

??????????? information[i].s_Name,

??????????? information[i].s_gender,

??????????? information[i].s_faculty,

??????????? information[i].s_speciality,

??????????? information[i].s_grade,

?? ?????????information[i].s_number);

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

??????????? credit[i].studentID,

??????????? credit[i].Name,

??????????? credit[i].compulsory,

??? ????????credit[i].select,

??????????? credit[i].morality,

????? ??????credit[i].innovate,

??????????? credit[i].other,

??????????? credit[i].sum);

??? }

??? fclose(informationfile_s);//關閉文件

??? fclose(creditfile_s);//關閉文件

??? int u = 0;

??? //獲取鼠標操作

? ??while (1)//時刻獲取鼠標信息

??? {

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

??????? {

??????????? MOUSEMSG view_b = GetMouseMsg();//設置變量引入消息

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

??????????? {

??????????? case WM_LBUTTONDOWN://左鍵

?????????????? ?//返回按鈕

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

??????????????? {

??????????????????? summary();//對學生數據進行操作

??????????????????? break;

??????????????? }

??????????????? //顯示學號按鈕

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

??????????????? {

??????????????????? TCHAR InputWindow_studentID[] = _T("請輸入要查找學生的學號,點擊確認鍵查找");

??????????????????? InputBox(information_buffer.s_studentID, 15, InputWindow_studentID);

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

??????????????????? //定位該生所在位置

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

??????????????????? {

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

??????????????????? ????{

???????? ???????????????????break;

??????????????????????? }

??????????????????? }

??????????????????? if (u == 42)

??????????????????? {

??????????????????????? HWND hnd = GetHWnd();

??????????????????????? int isok = MessageBox(hnd, "該學生不存在", "錯誤提示", MB_OKCANCEL);

??????????????????????? if (isok == IDOK)

??????????????????????? {

??????????????????????????? continue;

??????????????????????? }

??????????????????????? else if (IDCANCEL == isok)

??????????????????????? {

??????? ????????????????????continue;

?????? ?????????????????}

??????????????????? }

??????????????????? else

??????????????????? {

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

????????????? ??????}

??????????????? }

??????????????? //確定按鈕

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

??????????????? {

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

??????????????????? {

??????????????????????? HWND hnd = GetHWnd();

?????????? ?????????????int isok = MessageBox(hnd, "你還沒有輸入學號哦,請輸入", "錯誤提示", MB_OKCANCEL);

??????????????????????? if (isok == IDOK)

??????????????????????? {

??????????????????????????? continue;

??????????????????????? }

?????????????????????? ?else if (IDCANCEL == isok)

???????? ???????????????{

??????????????????????????? continue;

??????????????????????? }

??????????????????? }

??????????????????? else

??????????????????? {

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

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

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

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

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

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

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

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

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

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

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

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

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

??????????????????? }

??????????????? }

??????????????? //再查下一個按鈕

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

??????????????? {

??????????????????? view();//查找學生信息

??????????????????? break;

??????????????? }

???????????

??????????? }

??????? }

??? }

}

(十六)修改學生信息

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

{

??? IMAGE correct_s;//定義界面圖片指針

??? loadimage(&correct_s, "E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\界面圖片\\修改學生信息.png", 1280, 720);

??? putimage(0, 0, &correct_s);

??? settextcolor(BLACK);//設置字體顏色為黑色

??? setbkmode(TRANSPARENT);//消除字體背景顏色

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

???? UseStudentNumber();//載入學生數目

??? FILE* informationfile_s;//定義存取學生信息文件指針

??? FILE* creditfile_s;//定義存取學分信息文件指針

??? //打開文檔進行分析操作

??? informationfile_s = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生信息.txt", "r+");

??? creditfile_s = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生學分.txt", "r+");

??? //提取學生學分數據

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

??? {

??????? //判斷數據是否讀完

???? ???if (feof(informationfile_s) == 1)

??????? {

??????????? break;

??????? }

??????? //將文件數據保存在結構數組中

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

??????????? information[i].s_studentID,

??????????? information[i].s_Name,

??? ????????information[i].s_gender,

??????????? information[i].s_faculty,

??????????? information[i].s_speciality,

??????????? information[i].s_grade,

??????????? information[i].s_number);

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

??????????? credit[i].studentID,

??????????? credit[i].Name,

??????????? credit[i].compulsory,

??????????? credit[i].select,

??????????? credit[i].morality,

??????????? credit[i].innovate,

??????????? credit[i].other,

??????????? credit[i].sum);

??? }

??? fclose(informationfile_s);//關閉文件

??? fclose(creditfile_s);//關閉文件

??? int u = 0;

??? //按鍵的響應

??? while (1)//時刻獲取鼠標信息

??? {

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

??????? {

??????????? MOUSEMSG correct_q = GetMouseMsg();//設置變量引入消息

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

??????????? {

??????????? case WM_LBUTTONDOWN://左鍵

??????????????? //(返回)按鈕

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

??????????????? {

??????????????????? summary();//對學生數據進行操作

?????????? ?????????break;

??????????????? }

??????????????? //(輸入學號按鈕)

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

??????????????? {

??????????????????? char a[15];

??????????????? ????TCHAR InputWindow_studentID[] = _T("請輸入要修改學生的學號");

??????????????????? InputBox(a, 15, InputWindow_studentID);

???????????????????

??????????????????? //定位該生所在位置

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

??????????????????? {

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

??????????????????????? {

??????????????????????????? break;

??????????????????????? }

??????????????????? }

??????????????????? if (u == 42)

??????????????????? {

??????????????????????? HWND hnd = GetHWnd();

??????????????????? ????int isok = MessageBox(hnd, "該學生不存在", "錯誤提示", MB_OKCANCEL);

??????????????????????? if (isok == IDOK)

??????????????????????? {

??????????????????????????? continue;

??????????????????????? }

??????????????????????? else if (IDCANCEL == isok)

????????? ??????????????{

??????????????????????????? continue;

??????????????????????? }

??????????????????? }

??????????????????? else

??????????????????? {

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

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

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

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

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

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

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

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

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

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

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

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

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

??????????????????? }

??????????????? }

???????????????

??????????????? //(姓名)格

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

??????????????? {

?????????? ?????????TCHAR InputWindow_Name[] = _T("請輸入該學生的姓名");

??????????????????? InputBox(information_buffer.s_Name, 15, InputWindow_Name);

??????????????????? //進行輸出

??????????????????? outtextxy(789, 321, information_buffer.s_Name);

??????????????????? //保存在結構數組中

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

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

??????????????? }

??????????????? //(性別)格

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

??????????????? {

????????????????? ??TCHAR InputWindow_gender[] = _T("請輸入該學生的性別");

??????????????????? InputBox(information_buffer.s_gender, 15, InputWindow_gender);

??????????????????? //進行輸出

????????????? ??????outtextxy(789, 359, information_buffer.s_gender);

??????????????????? //保存在結構數組中

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

??????????????? }

??????????????? //(院系)格

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

??????????????? {

??????????????????? TCHAR InputWindow_faculty[] = _T("請輸入該學生的院系全稱");

??????????????????? InputBox(information_buffer.s_faculty, 15, InputWindow_faculty);

??????????????????? //進行輸出

?????????????? ?????outtextxy(789, 398, information_buffer.s_faculty);

??????????????????? //保存在結構數組中

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

??????????????? }

??????????????? //(專業)格

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

??????????????? {

??????????????????? TCHAR InputWindow_speciality[] = _T("請輸入該學生的專業");

??????????????????? InputBox(information_buffer.s_speciality, 15, InputWindow_speciality);

?????????? ?????????//進行輸出

??????????????????? outtextxy(789, 436, information_buffer.s_speciality);

??????????????????? //保存在結構數組中

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

??????????????? }

?? ?????????????//(年級)格

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

??????????????? {

??????????????????? TCHAR InputWindow_grade[] = _T("請輸入該學生的年級,例(2201)22屆1班");

??????????????????? InputBox(information_buffer.s_grade, 15, InputWindow_grade);

??????????????????? //進行輸出

??????????????????? outtextxy(789, 475, information_buffer.s_grade);

??????????????????? //保存在結構數組中

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

??????????????? }

? ??????????????//(手機號)格

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

??????????????? {

??????????????????? TCHAR InputWindow_number[] = _T("請輸入該學生的手機號");

??????????????????? InputBox(information_buffer.s_number, 15, InputWindow_number);

??????????????????? // 進行輸出

??????????????????? outtextxy(822, 515.53, information_buffer.s_number);

??????????????????? //保存在結構數組中

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

?????????????? ?}

??????????????? //(必修)格

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

??????????????? {

????? ??????????????TCHAR InputWimdow_compulsory[] = _T("請輸入該學生的必修");

????????????????? ??InputBox(credit_buffer.compulsory, 15, InputWimdow_compulsory);

??????????????????? // 進行輸出

??????????????????? outtextxy(1043, 321, credit_buffer.compulsory);

????????? ??????????//保存在結構數組中

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

??????????????? }

??????????????? //(選修)格

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

??????????????? {

??????????????????? TCHAR InputWimdow_select[] = _T("請輸入該學生的選修");

????? ??????????????InputBox(credit_buffer.select, 15, InputWimdow_select);

????????? ??????????// 進行輸出

??????????????????? outtextxy(1043, 359, credit_buffer.select);

??????????????????? //保存在結構數組中

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

??????? ????????}

??????????????? //(德育)格

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

??????????????? {

??????????????????? TCHAR InputWimdow_morality[] = _T("請輸入該學生的德育");

??????????? ????????InputBox(credit_buffer.morality, 15, InputWimdow_morality);

??????????????????? // 進行輸出

??????????????????? outtextxy(1043, 398, credit_buffer.morality);

??????????????????? //保存在結構數組中

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

? ??????????????}

??????????????? //(創新)格

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

??????????????? {

??????????????????? TCHAR InputWimdow_innovate[] = _T("請輸入該學生的創新");

??? ????????????????InputBox(credit_buffer.innovate, 15, InputWimdow_innovate);

??????????????????? // 進行輸出

??????????????????? outtextxy(1043, 436, credit_buffer.innovate);

??????????????????? //保存在結構數組中

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

??????????????? }

??????????????? //(其它)格

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

??????????????? {

??????????????????? TCHAR InputWimdow_other[] = _T("請輸入該學生的其它學分");

??????????????? ????InputBox(credit_buffer.other, 15, InputWimdow_other);

??????????????????? // 進行輸出

????????? ??????????outtextxy(1043, 475, credit_buffer.other);

??????????????????? //保存在結構數組中

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

??????? ????????}

??????????????? //(總分)格

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

??????????????? {

??????????????????? //計算總分

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

??????????????????? //賦予數組

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

??????????????????? //進行輸出

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

??????????????? }

??????????????? //(確定)按鈕

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

??????????????? {

??????????????????? FILE* correct_g;//定義輸入信息文件指針

???????????????? ???FILE* correct_l;//定義存取信息文件指針

??????????????????? //打開文檔進行分析操作

??????????????????? correct_g = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生信息.txt", "w+");

??????????????????? correct_l = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生學分.txt", "w+");

?????????????????? ???? UseStudentNumber();//載入學生數目

??????????????????? int y;//循環變量

??????????????????? //存入學生數據

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

??????????????????? {

??????????????????????? //判斷數據是否存完

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

????????? ??????????????{

??????????????????????????? break;

??????????????????????? }

??????????????????????? //將結構數據保存在文件中

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

??????????????????? ????????information[y].s_studentID,

??????????????????????????? information[y].s_Name,

??????????????????????????? information[y].s_gender,

??????????????????????????? information[y].s_faculty,

??????????????????????????? information[y].s_speciality,

???? ???????????????????????information[y].s_grade,

??????????????????????????? information[y].s_number);

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

??????????????????????????? credit[y].studentID,

????????????? ??????????????credit[y].Name,

??????????? ????????????????credit[y].compulsory,

??????????????????????????? credit[y].select,

??????????????????????????? credit[y].morality,

??????????????????????????? credit[y].innovate,

??????????????????????????? credit[y].other,

???????? ???????????????????credit[y].sum);

? ??????????????????}

??????????????????? fclose(correct_g);//關閉文件

??????????????????? fclose(correct_l);//關閉文件

???? ???????????????HWND hnd = GetHWnd();

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

???????? ???????????if (isok == IDOK)

??????????????????? {

??????????????????????? interdict = 1;

??????????????????????? continue;

??????????????????? }

??????????????????? else if (IDCANCEL == isok)

??????????????????? {

?????????????????? ?????interdict = 1;

? ??????????????????????continue;

??????????????????? }

??????????????? }

??????????????? //(再填下一個)按鈕

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

??????????????? {

?????? ?????????????correct();//修改學生信息

?????????????????? ???? UseStudentNumber();//載入學生數目

??????????????? }

??????????? }

??????? }

??? }

}

(十七)學生窗口

void studentwindows()//學生窗口

{

??? IMAGE correct_s;//定義界面圖片指針

??? loadimage(&correct_s, "E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\界面圖片\\學生主頁.png", 1280, 720);

??? putimage(0, 0, &correct_s);

??? //按鍵的響應

??? while (1)//時刻獲取鼠標信息

??? {

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

??????? {

??????????? MOUSEMSG credit_c = GetMouseMsg();//設置變量引入消息

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

??????????? {

?????? ?????case WM_LBUTTONDOWN://左鍵

???? ???????????//(返回)按鈕

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

??????????????? {

??????????????????? main();//主窗口

??????????????????? break;

??????????????? }

?? ?????????????//(我要登錄)按鈕

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

??????????????? {

?????????????????????? UseStudentNumber();//載入學生數目

??????????????????? student_login();

??????????????????? break;

? ??????????????}

??? ????????????//(我要注冊)按鈕

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

??????????????? {

?????????????????????? UseStudentNumber();//載入學生數目

??????????????????? student_registration();//學生注冊

???????????????? ???break;

???? ???????????}

??????????? }

??????? }

??? }

}

(十八)載入學生數目

void UseStudentNumber()

{

???? FILE *fp = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生數據.txt","r+");

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

???? fclose(fp);

}

(十九)存儲學生數目

void SaveStudentNumber()

{

???? FILE *fp = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生數據.txt","w");

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

???? fclose(fp);

}

(二十)學生注冊

void student_registration()//學生注冊

{

??? IMAGE correct_s;//定義界面圖片指針

??? loadimage(&correct_s, "E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\界面圖片\\學生注冊界面.png", 1280, 720);

??? putimage(0, 0, &correct_s);

??? settextcolor(BLACK);//設置字體顏色為黑色

??? setbkmode(TRANSPARENT);//消除字體背景顏色

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

???? UseStudentNumber();//載入學生數目

??? FILE* informationfile_s;//定義存取學生信息文件指針

??? FILE* creditfile_s;//定義存取學分信息文件指針

??? //打開文檔進行分析操作

??? informationfile_s = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生信息.txt", "r+");

??? creditfile_s = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生學分.txt", "r+");

??? //提取學生學分數據

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

??? {

?? ?????//判斷數據是否讀完

??????? if (feof(informationfile_s) == 1)

??????? {

??????????? break;

??????? }

??????? //將文件數據保存在結構數組中

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

??????????? information[i].s_studentID,

??????????? information[i].s_Name,

??????????? information[i].s_gender,

??????????? information[i].s_faculty,

??????????? information[i].s_speciality,

??????????? information[i].s_grade,

??????????? information[i].s_number);

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

????????? ??credit[i].studentID,

??????????? credit[i].Name,

??????????? credit[i].compulsory,

??????????? credit[i].select,

??????????? credit[i].morality,

??????????? credit[i].innovate,

??????????? credit[i].other,

?????????? ?credit[i].sum);

??? }

??? fclose(informationfile_s);//關閉文件

??? fclose(creditfile_s);//關閉文件

???? //nowstudentnums = 0;//初始化為0

??? TCHAR InputWindow_studentID[] = _T("請輸入你的學號");

??? InputBox(information_buffer.s_studentID, 15, InputWindow_studentID);

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

??? {

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

??????? {

??????????? HWND h = GetHWnd();

??????????? int i = MessageBox(h, "此用戶已注冊", "錯誤提示", MB_OKCANCEL);

???????? ???if (i == IDOK)

??? ????????{

???? ???????????student_registration();

??????????? }

??????????? else if (IDCANCEL == i)

??????????? {

??????????????? studentwindows();

??????????? }

??????? }

??? }

??? //保存在結構數組中

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

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

???

??? //對于成績學生無權操作,直接賦值無

??? char NO[3] = "無";

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

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

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

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

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

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

??? int v = 0;

??? //按鍵的響應

??? while (1)//時刻獲取鼠標信息

??? {

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

??????? {

??????????? MOUSEMSG correct_q = GetMouseMsg();//設置變量引入消息

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

??????????? {

??????????? case WM_LBUTTONDOWN://左鍵

??????????????? //(返回)按鈕

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

??????????????? {

??????????????????? studentwindows();//學生窗口

??????????????????? break;

??????????????? }

??????????????? //(姓名)格

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

??????????????? {

??????????????????? TCHAR InputWindow_Name[] = _T("請輸入你的姓名");

??????????????????? InputBox(information_buffer.s_Name, 15, InputWindow_Name);

??????????????????? //進行輸出

??????????????? ????outtextxy(481.84, 240, information_buffer.s_Name);

??????????????????? //保存在結構數組中

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

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

????????? ??????????v += 1;

??????????????? }

??????????????? //(性別)格

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

??????????????? {

??????????????????? TCHAR InputWindow_gender[] = _T("請輸入你的性別");

??????????????????? InputBox(information_buffer.s_gender, 15, InputWindow_gender);

??????????????????? //進行輸出

??????????????????? outtextxy(481.84, 280, information_buffer.s_gender);

??????????????????? //保存在結構數組中

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

??????????????????? v += 1;

??????????????? }

??????????????? //(院系)格

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

??????? ????????{

??????????????????? TCHAR InputWindow_faculty[] = _T("請輸入你的院系全稱");

??????????????????? InputBox(information_buffer.s_faculty, 15, InputWindow_faculty);

??????????????????? //進行輸出

??????????????????? outtextxy(481.84, 320, information_buffer.s_faculty);

??????????????????? //保存在結構數組中

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

??????????????????? v += 1;

??????????????? }

??????????????? //(專業)格

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

??????????????? {

??????????????????? TCHAR InputWindow_speciality[] = _T("請輸你的專業");

??????????????????? InputBox(information_buffer.s_speciality, 15, InputWindow_speciality);

???????? ???????????//進行輸出

??????????????????? outtextxy(481.84, 360, information_buffer.s_speciality);

??????????????????? //保存在結構數組中

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

??????????? ????????v += 1;

??????????????? }

??????????????? //(年級)格

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

??????????????? {

??????????????????? TCHAR InputWindow_grade[] = _T("請輸入你的年級,例(2201)22屆1班");

??????????????????? InputBox(information_buffer.s_grade, 15, InputWindow_grade);

??????????????????? //進行輸出

??????????????????? outtextxy(481.84, 400, information_buffer.s_grade);

??????????????????? //保存在結構數組中

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

??????????????????? v += 1;

??????????????? }

??????????????? //(手機號)格

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

??????????????? {

??????????????????? TCHAR InputWindow_number[] = _T("請輸入你的手機號");

??????????????????? InputBox(information_buffer.s_number, 15, InputWindow_number);

??????????????????? // 進行輸出

??????????????????? outtextxy(503.76, 435, information_buffer.s_number);

?? ?????????????????//保存在結構數組中

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

??????????????????? v += 1;

??????????????? }

??????????????? //(確定注冊)按鈕

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

??????????????? {

??????????????????? if (v != 6)

??????????????????? {

??????????????????????? HWND hn = GetHWnd();

?????? ?????????????????int iso = MessageBox(hn, "還有數據沒有輸入完哦", "錯誤提示", MB_OKCANCEL);

?????? ?????????????????if (iso == IDOK)

??????????????????????? {

??????????????????????????? interdict = 1;

??????????????????????????? continue;

??????????????????????? }

??????????????????????? else if (IDCANCEL == iso)

? ??????????????????????{

???????????? ???????????????interdict = 1;

??????????????????????????? continue;

??????????????????????? }

??????????????????? }

??????????????????? else

??????????????????? {

??????????????????????? FILE* correct_g;//定義輸入信息文件指針

?? ?????????????????????FILE* correct_l;//定義存取信息文件指針

??????????????????????? //打開文檔進行分析操作

??????????????????????? correct_g = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生信息.txt", "w+");

??????????????????????? correct_l = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生學分.txt", "w+");

??????????????????????????? //UseStudentNumber();//載入學生數目

??????????????????????? int y;//循環變量

??????????????????????????? //int num;

??????????????????????????? //num = nowstudentnums + 1;

??????????????????????? //存入學生數據

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

?????? ?????????????????{

??????????????????????????? //判斷數據是否存完

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

??????????????????????????? {

??????????????????????????????? break;

?????????????????????? ?????}

?????????????? ?????????????//將結構數據保存在文件中

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

??????????????????????????????? information[y].s_studentID,

??????????????????????????????? information[y].s_Name,

?????????????????? ?????????????information[y].s_gender,

??????????????????????????????? information[y].s_faculty,

??????????????????????????????? information[y].s_speciality,

??????????????????????????????? information[y].s_grade,

??????????????????????????????? information[y].s_number);

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

??????????????????????????????? credit[y].studentID,

??????????????????????????????? credit[y].Name,

??????????????????????????????? credit[y].compulsory,

????????? ??????????????????????credit[y].select,

??????????????????????????????? credit[y].morality,

??????????????????????????????? credit[y].innovate,

??????????????????????????????? credit[y].other,

??????????????????????????????? credit[y].sum);

?????????????? ?????????}

?????????? ?????????????fclose(correct_g);//關閉文件

??????????????????????? fclose(correct_l);//關閉文件

??????????????????????? nowstudentnums = nowstudentnums + 1;//

??????????????????????????? SaveStudentNumber();//保存現有學生數量

??????????????????????? HWND hnd = GetHWnd();

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

??????????????????????? if (isok == IDOK)

??????????????????????? {

??????????????????????????? interdict = 1;

??????????????????????????? continue;

??????????????????????? }

??????????????????? ????else if (IDCANCEL == isok)

??????????????????????? {

??????????????????????????? interdict = 1;

??????????????????????????? continue;

??????????????????????? }

??????????????????? }

??????????????? }

??????????? }

??????? }

??? }

}

(二十一)學生登錄

void student_login()// 學生登錄

{

??? IMAGE correct_s;//定義界面圖片指針

??? loadimage(&correct_s, "E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\界面圖片\\學生登錄界面.png", 1280, 720);

??? putimage(0, 0, &correct_s);

??? settextcolor(BLACK);//設置字體顏色為黑色

??? setbkmode(TRANSPARENT);//消除字體背景顏色

??? settextstyle(25, 0, _T("Consolas"));//設置字體大小

???? UseStudentNumber();//載入學生數目

??? FILE* informationfile_s;//定義存取學生信息文件指針

??? FILE* creditfile_s;//定義存取學分信息文件指針

??? //打開文檔進行分析操作

??? informationfile_s = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生信息.txt", "r+");

??? creditfile_s = fopen("E:\\C語言的軟件\\VS\\系統菜單\\圖片和數據存放地\\數據\\學生學分.txt", "r+");

??? //提取學生學分數據

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

??? {

??????? //判斷數據是否讀完

??????? if (feof(informationfile_s) == 1)

??????? {

??????????? break;

??????? }

??????? //將文件數據保存在結構數組中

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

??????????? &information[i].s_studentID,

??????????? &information[i].s_Name,

??????????? &information[i].s_gender,

??????????? &information[i].s_faculty,

??????????? &information[i].s_speciality,

???????? ???&information[i].s_grade,

??????????? &information[i].s_number);

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

??????????? &credit[i].studentID,

??????????? &credit[i].Name,

??????????? &credit[i].compulsory,

??????????? &credit[i].select,

? ??????????&credit[i].morality,

??????????? &credit[i].innovate,

??????????? &credit[i].other,

??????????? &credit[i].sum);

??? }

??? fclose(informationfile_s);//關閉文件

??? fclose(creditfile_s);//關閉文件

??? TCHAR InputWindow_studentID[] = _T("請輸入你的學號");

??? InputBox(information_buffer.s_studentID, 15, InputWindow_studentID);

??? int u = 0;

??? //定位該生所在位置

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

??? {

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

??????? {

?????????? ?break;

?????? ?}

??? }

??? if (u == 42)

??? {

??????? HWND hnd = GetHWnd();

??????? int isok = MessageBox(hnd, "你還沒有注冊,請注冊", "錯誤提示", MB_OKCANCEL);

??????? if (isok == IDOK)

??????? {

??????????? student_registration();//學生注冊

??????? }

??????? else if (IDCANCEL == isok)

??????? {

??????????? studentwindows();//學生窗口

??????? }

??? }

??? //在指定的圖框中顯示

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

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

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

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

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

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

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

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

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

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

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

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

??? //獲取鼠標操作

??? while (1)//時刻獲取鼠標信息

??? {

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

??????? {

?????? ?????MOUSEMSG correct_b = GetMouseMsg();//設置變量引入消息

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

?? ?????????{

??????????? case WM_LBUTTONDOWN://左鍵

??????????????? //返回按鈕

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

??????????????? {

??????????????????? studentwindows();//學生窗口

??????????????????? break;

??????????????? }

??????????? }

??????? }

??? }

}

四、調試分析

從主界面到管理員界面或者學生界面使用Easy-x坐標定位來進行調試,再到之后的顯示學生信息和學分全攬,發現是空白,什么都沒有,所以推測是輸入的問題,也可能是文件的問題。于是找到對應模塊進行調試,進入管理員界面內的錄入學生信息和學生注冊,發現錄入學生信息顯示錄入學生已滿,所以現在數據已經達到了最大容量值了,但為什么還是寫不上去。于是我打開文件,看了一下有42行空白,有字節數,說明是寫進去了,但是沒有完全將有用的數據寫入,而且還有無用的數據寫入,于是將對應模塊的代碼斷點逐行調試,發現是變量nowstudentsnum的問題,基于這個問題,寫了兩個函數來控制認識的變化,每次需要看人數時,調用UseStudentNumber函數,用完之后,人數增加或者減少,再用SaveStudentNumber函數,來控制變量的范圍,于是改了之后代碼達到了預期的效果。

五、測試結果

從主界面能順利跳轉到(第一個按鈕)管理員界面或者(第二個按鈕)學生界面,如圖1-1,進入管理員界面需要輸入密碼,如圖1-2。

圖1-1 首界面

圖1-2 管理員登錄密碼

進入管理員界面,可以正常跳轉到管理員界面,如圖2-1.在管理員界面,(第一個按鈕)到查看所有學生的個人信息表和學分信息表,如圖2-2和2-3。(第二個按鈕)可以到對學生數據進行操作(增加,刪除,查找,修改),并且將操作后的數據存儲到文件中。

圖2-1 管理員界面

圖2-2 學生學分全攬

圖2-3 學生信息全攬

??進入修改,添加學生數據界面,如圖3-1。有對應的4個按鈕,有錄入學生信息(第一個按鈕),如圖3-2。刪除學生信息(第二個按鈕),如圖3-3。查找學生信息(第三個按鈕),如圖3-4。修改學生信息(第四個按鈕),如圖3-5,將學生數據進行對應的操作后可以將對應信息儲存到相應的文件中。

圖3-1 管理員操作全攬

圖3-2 錄入操作

圖3-3 刪除操作

圖3-4 查詢操作

圖3-5 修改操作

進入學生界面,如圖4-1。可以跳轉到(第一個按鈕)學生登錄界面,如圖4-2。或者可以跳轉到(第二個按鈕)學生注冊界面,如圖4-3。也可以點擊頁面返回回溯到首頁面,如圖4-4。進入對應的頁面進行可以進行學生登錄或者注冊,完成流程后的同時可以直接將學生信息(如圖4-5),學生學分(如圖4-6),學生人數(如圖4-7)直接寫入文件中

圖4-1 同學界面

圖4-2 登錄界面

圖4-3 注冊界面

圖4-4 主界面

圖4-5 學生信息存儲文件

圖4-6 學生學分存儲文件

圖4-7 學生人數存儲文件

六、課程心得總結

通過完成這個學生管理系統的創作,從開始的界面,到中間的頁面之間的跳轉,我從學習Easy-x的函數到逐步掌握,通過寫這個學生管理系統也是見證了我代碼能力的成長,逐漸熟練掌握調試,斷點,檢查代碼錯誤,文件的存儲,頁面的變換,按鈕的設計,通過這次學生管理系統的創作,也是助推我代碼能力的成長助推器,也愿在以后的代碼求學路上,我仍能保持初心,一直走下去。

七、參考文獻

[1]甘勇,李曄,盧冰.C語言程序設計[M].北京:中國鐵道出版社,2014.

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/web/46370.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/46370.shtml
英文地址,請注明出處:http://en.pswp.cn/web/46370.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

網頁制作技術:概念、現狀與展望?

網頁制作技術&#xff1a;概念、現狀與展望&#xff1f; 李升偉 網頁制作技術是指用于創建和維護網站的一系列技術和方法。 概念&#xff1a; 它涉及多個方面&#xff0c;包括使用 HTML&#xff08;超文本標記語言&#xff09;來構建網頁的結構和內容&#xff0c;使用 CSS&…

Rust Result 與可恢復的錯誤

Result 與可恢復的錯誤 大部分錯誤并沒有嚴重到需要程序完全停止執行。有時&#xff0c;一個函數會因為一個容易理解并做出反應的原因失敗。例如&#xff0c;如果因為打開一個并不存在的文件而失敗&#xff0c;此時我們可能想要創建這個文件&#xff0c;而不是終止進程。 回憶…

RT-DETR+Flask實現目標檢測推理案例

今天&#xff0c;帶大家利用RT-DETR&#xff08;我們可以換成任意一個模型&#xff09;Flask來實現一個目標檢測平臺小案例&#xff0c;其實現效果如下&#xff1a; 目標檢測案例 這個案例很簡單&#xff0c;就是讓我們上傳一張圖像&#xff0c;隨后選擇一下置信度&#xff0c;…

GPT LangChain experimental agent - allow dangerous code

題意&#xff1a;GPT LangChain 實驗性代理 - 允許危險代碼 問題背景&#xff1a; Im creating a chatbot in VS Code where it will receive csv file through a prompt on Streamlit interface. However from the moment that file is loaded, it is showing a message with…

第12章 結構化命令《Linux命令行與Shell腳本編程大全筆記》

12.1 if-then命令 不同于其他語言&#xff0c;if后面不是一個等式&#xff0c;而是命令&#xff0c;如果命令運行成功返回狀態碼0則運行then語句部分把分號&#xff08;;&#xff09;放到命令尾部&#xff0c;可以將then語句寫在同一行 12.4 test命令 格式&#xff1a;if te…

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

問題 今天初次嘗試在pycharm上創建與激活虛擬環境&#xff0c;創建結束后&#xff0c;使用命令conda activate pytorch激活虛擬環境時出現以下報錯&#xff1a; usage: conda-script.py [-h] [–no-plugins] [-V] COMMAND … conda-script.py: error: argument COMMAND: inval…

Selenium原理深度解析

在自動化測試領域&#xff0c;Selenium無疑是最受歡迎和廣泛使用的工具之一。它支持多種瀏覽器和操作系統&#xff0c;為開發人員和測試人員提供了強大的自動化測試解決方案。本文將深入探討Selenium的工作原理&#xff0c;包括其架構、核心組件、執行流程以及它在自動化測試中…

獨立開發者系列(26)——域名與解析

域名&#xff08;英語&#xff1a;Domain Name&#xff09;&#xff0c;又稱網域&#xff0c;是由一串用點分隔的名字組成的互聯網上某一臺計算機或計算機組的名稱&#xff0c;用于在數據傳輸時對計算機的定位標識&#xff08;有時也指地理位置&#xff09;。 由于IP地址不方便…

postMessageXss續2

原文地址如下:https://research.securitum.com/art-of-bug-bounty-a-way-from-js-file-analysis-to-xss/ 在19年我寫了一篇文章&#xff0c;是基于postMessageXss漏洞的入門教學:https://www.cnblogs.com/piaomiaohongchen/p/14727871.html 這幾天瀏覽mXss技術的時候&#xff…

模型蒸餾、量化、裁剪的概念和區別

模型壓縮概述 1.1 模型壓縮的重要性 隨著深度學習技術的快速發展&#xff0c;神經網絡模型在各種任務中取得了顯著的成功。然而&#xff0c;這些模型通常具有大量的參數和復雜的結構&#xff0c;導致模型體積龐大、計算資源消耗高和推理時間長。這些問題限制了深度學習模型在…

車載音視頻App框架設計

簡介 統一播放器提供媒體播放一致性的交互和視覺體驗&#xff0c;減少各個媒體應用和場景獨自開發的重復工作量&#xff0c;實現媒體播放鏈路的一致性&#xff0c;減少碎片化的Bug。本文面向應用開發者介紹如何快速接入媒體播放器。 主要功能&#xff1a; 新設計的統一播放U…

新版本cesium編譯1.103之后的版本

cesium1.1之后的版本文件結構域1.1之前的版本有了很大的差別&#xff0c;源碼也全部移到了packages目錄中。有很多依賴包沒有寫在根目錄的package.json文件中。npm i 后直接編譯會保持。 cesium源碼git https://github.com/CesiumGS/cesium 1、添加缺少的包&#xff0c;缺少的…

4. 雙端口ram設計

1. 設計要求 設計一個位寬8bit&#xff0c;地址深度為128&#xff0c;可以同時讀寫的雙端口RAM 要求&#xff1a;模塊名字為RAM_DUAL 輸入端口&#xff1a;ADDR_W&#xff0c;ADDR_R CLK_R&#xff0c;CLK_W&#xff0c;RSTn ADDR_R[6:0]&#xff0c;ADDR_W[6:0] DATA_WR…

k8s學習——創建測試鏡像

創建一個安裝了ifconfig、telnet、curl、nc、traceroute、ping、nslookup等網絡工具的鏡像&#xff0c;便于集群中的測試。 創建一個Dockerfile文件 # 使用代理下載 Ubuntu 鏡像作為基礎 FROM docker.m.daocloud.io/library/ubuntu:latest# 設置環境變量 DEBIAN_FRONTEND 為 …

學習測試9-接口測試 2-抓包工具Fiddler

Fiddler 抓包工具的使用 怎么找接口信息&#xff0c;可以通過瀏覽器的開發者工具 Fiddler 是一個 HTTP 協議調試代理工具 File 菜單&#xff1a; Capture Traffic&#xff08;或 F12&#xff09;&#xff1a;是個開關&#xff0c;可以控制是否把 Fiddler 注冊為系統代理。當把…

淺談Open.Json.pickle.Os

一、Open函數使用 open函數是 Python 中用于打開文件的內置函數&#xff0c;它返回一個文件對象&#xff0c;該文件對象提供了對文件進行讀寫操作的方法。使用 open 函數時&#xff0c;通常需要指定至少兩個參數&#xff1a;文件名&#xff08;file&#xff09;和模式&#xf…

【網絡工具】Charles 介紹及環境配置

?個人博客&#xff1a;Pandaconda-CSDN博客 &#x1f4e3;專欄地址&#xff1a;http://t.csdnimg.cn/iAmAo &#x1f4da;專欄簡介&#xff1a;在這個專欄中&#xff0c;我將會整理一些工作或學習中用到的工具介紹給大家~ &#x1f4d8;Charles 系列其它文章&#xff1a;【網絡…

Git操縱本地倉庫和遠程倉庫

git是一個代碼托管的平臺&#xff0c;我們可以對我們的代碼進行分支 推送提交 打標簽等等操作&#xff0c;而且git使用過程中也是支持一些linux語言的 比如cd呀 touch mkdir啊等等等 git的具體安裝過程就不再贅述 我個人認為 好多東西就是 代碼也好 文字 文檔 也好&…

【C語言】結構體,枚舉,聯合超詳解!!!

目錄 結構體 結構體聲明 結構體成員的訪問 結構體自引用 結構體變量定義&#xff0c;初始化&#xff0c;傳參 結構體內存對齊 位段 枚舉 聯合(共用體) 結構體 結構體聲明 1. 概念 1. 結構體是一些值的集合&#xff0c;這些值稱為成員變量。 2. 結構體的每個成員可…

長難句打卡7.15

The trend was naturally most obvious in those areas of science based especially on a mathematical or laboratory training, and can be illustrated in terms of the development of geology in the United Kingdom 這一趨勢自然在以數學或實驗室訓練為基礎的科學領域里…