#include"person.h" using namespace std;
struct bookmessage //与书有关的信息 { char name[50]; float price; char chubanshe[50]; char author[50]; int num; int jieyue; };
struct node //创建链表储存数据 { struct bookmessage data; struct node* next; };
struct node* creathead() { struct node* headnode = (struct node*)malloc(sizeof(struct node)); headnode->next = NULL; return headnode; }
struct node* creatnode(struct bookmessage data) { struct node* newnode = (struct node*)malloc(sizeof(struct node)); newnode->data = data; newnode->next = NULL; return newnode; };
void printflist(struct node* headnode) { IMAGE backimg; IMAGE choiseimg; system("cls"); int select; initgraph(640, 480); loadimage(&backimg, "004.jpg", 640, 480); loadimage(&choiseimg, "001.jfif", 420, 30); putimage(0, 0, &backimg); putimage(120, 130, &choiseimg); putimage(120, 180, &choiseimg); putimage(120, 230, &choiseimg); putimage(120, 280, &choiseimg); putimage(120, 330, &choiseimg); putimage(120, 380, &choiseimg); putimage(120, 430, &choiseimg);
setbkmode(TRANSPARENT); setcolor(YELLOW); settextstyle(40, 0, "Century Gothic"); outtextxy(205, 10, "z1in图书管理系统"); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(135, 135, "------------------------------图书信息-----------------------------"); outtextxy(135, 185, "书名 作者 出版社 单价 馆藏量 借阅数"); struct node* pmove = headnode->next; char tempstr[150]; int x = 0; while (pmove != NULL) { sprintf(tempstr, "%-10s %-10s %-14s %-10.1f %-14d %-6d\n", pmove->data.name, pmove->data.author, pmove->data.chubanshe, pmove->data.price, pmove->data.num, pmove->data.jieyue); outtextxy(135, 235+x, tempstr); x += 50; pmove = pmove->next; } outtextxy(315, 435, "退出"); MOUSEMSG msg; while (1) { msg = GetMouseMsg(); switch (msg.uMsg) { case WM_LBUTTONDOWN: if (msg.x >= 120 && msg.x <= 540 && msg.y >= 430 && msg.y <= 460) { closegraph(); return; } } } }
void insertnodebyhead(struct node* headnode, struct bookmessage data) { struct node* newnode = creatnode(data); newnode->next = headnode->next; headnode->next = newnode; }
struct node* list = NULL;
void deletenotebyname(struct node* headnode, char* bookname) { struct node* posleftnode = headnode; struct node* posnode = headnode->next; while (posnode != NULL && strcmp(posnode->data.name, bookname)) { posleftnode = posnode; posnode = posleftnode->next; } if (posnode == NULL) { cout << "该书不存在哦" << endl; return; } else { cout << "删除成功,正在返回中,请稍后........." << endl; Sleep(1500); posleftnode->next = posnode->next; free(posnode); posnode = NULL; } }
struct node* searchbyname(struct node* headnode, char* bookname) { struct node* posnode = headnode->next; while (posnode != NULL && strcmp(posnode->data.name, bookname)) { posnode = posnode->next; } return posnode; }
struct node* searchbyauthor(struct node* headnode, char* authorname) { struct node* posnode = headnode->next; while (posnode != NULL && strcmp(posnode->data.author, authorname)) { posnode = posnode->next; } return posnode; }
struct node* searchbychubanshe(struct node* headnode, char* chubanshe) { struct node* posnode = headnode->next; while (posnode != NULL && strcmp(posnode->data.chubanshe, chubanshe)) { posnode = posnode->next; } return posnode; }
void showpower(); void showreader(); void password_circle();
void adb(); int reb(); void deb(); int seb();
void adp(); int rep(); int dep(); int sep();
IMAGE backimg; IMAGE choiseimg;
int jieshu(struct node_pe*** reader); int huanshu(struct node_pe*** reader); int xujie(struct node_pe*** reader);
void bookcon(); void personcon(); void readers( struct node_pe* reader);
int rogin(); struct personmessage register_(); void quit(); int login();
void aboutme() { IMAGE backimg; IMAGE choiseimg; initgraph(640, 480); loadimage(&backimg, "004.jpg", 640, 480); loadimage(&choiseimg, "002.jfif", 60,30); putimage(0, 0, &backimg); putimage(280, 400, &choiseimg);
setbkmode(TRANSPARENT); setcolor(YELLOW); settextstyle(40, 0, "Century Gothic"); outtextxy(205, 10, "z1in图书管理系统"); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(105, 160, "这是一个来自03组的图书管理系统,可能还会有很多的bug"); outtextxy(105, 210, "和不成熟的地方,欢迎大家的指导与纠正。"); outtextxy(295, 405, "返回");
MOUSEMSG msg; while (1) { msg = GetMouseMsg(); switch (msg.uMsg) { case WM_LBUTTONDOWN: if (msg.x >= 280 && msg.x <= 400 && msg.y >= 400 && msg.y <= 430) { closegraph(); return; } } } }
void bubblesort(struct node* headnode) { struct node* firstnode = headnode->next; struct node* secondnode = headnode; while (firstnode != NULL) { while (firstnode->next != NULL) { if (firstnode->data.jieyue < firstnode->next->data.jieyue) { struct bookmessage temp = firstnode->data; firstnode->data = firstnode->next->data; firstnode->next->data = temp; } firstnode = firstnode->next; } firstnode = secondnode->next; secondnode = firstnode; } }
void saveinfotofile(const char* filename, struct node* headnode) { FILE* fp = fopen(filename, "w"); struct node* pmove = headnode->next; while (pmove != NULL) { fprintf(fp, "%s\t%s\t%.1f\t%s\t%d\t%d\n", pmove->data.name, pmove->data.author, pmove->data.price, pmove->data.chubanshe, pmove->data.num, pmove->data.jieyue); pmove = pmove->next; } fclose(fp); }
void readinfofromfile(const char* filename, struct node* headnode) { FILE* fp = fopen(filename, "r"); if (fp == NULL) { fp = fopen(filename, "w+"); } struct bookmessage tempdata; while (fscanf(fp, "%s\t%s\t%f\t%s\t%d\t%d\n", tempdata.name, tempdata.author, &tempdata.price, tempdata.chubanshe, &tempdata.num, &tempdata.jieyue) != EOF) { insertnodebyhead(list, tempdata); }
fclose(fp); }
void showpower() { system("title 计科20061107-z1in"); cout << "\n\n\n\n\n\n\n" << endl; cout << "\t\t\t正在打开03组的图书管理系统,请稍等........" << endl; printf("\t\t\t 欢迎使用图书管理系统\n\n\n\n"); printf("\t\t****************************************************\n"); printf("\t\t* ********** ********** *\n"); printf("\t\t* * * * *\n"); printf("\t\t* * * * *\n"); printf("\t\t* * * * *\n"); printf("\t\t* * * ********** *\n"); printf("\t\t* * * * *\n"); printf("\t\t* * * * *\n"); printf("\t\t* * * * *\n"); printf("\t\t* * * * *\n"); printf("\t\t* ********** ********** *\n"); printf("\t\t****************************************************\n"); Sleep(2500); }
void password_circle() { system("cls"); printf("\n\n\n\t\t\t***================================*** \n"); printf("\t\t\t \n"); printf("\t\t\t 学号 (account):"); }
void adb() { IMAGE backimg; IMAGE choiseimg; IMAGE selectimg;
system("cls"); int select; zxy:initgraph(640, 480); loadimage(&backimg, "004.jpg", 640, 480); loadimage(&choiseimg, "001.jfif", 420, 30); loadimage(&selectimg, "002.jfif", 80, 30);
putimage(0, 0, &backimg); putimage(100, 130, &choiseimg); putimage(100, 180, &choiseimg); putimage(100, 230, &choiseimg); putimage(100, 280, &choiseimg); putimage(100, 330, &choiseimg); putimage(120, 430, &selectimg); putimage(430, 430, &selectimg);
setbkmode(TRANSPARENT); setcolor(YELLOW); settextstyle(40, 0, "Century Gothic"); outtextxy(205, 10, "z1in图书管理系统"); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(130, 135, "请输入书籍的名称"); outtextxy(130, 185, "请输入书籍的价格"); outtextxy(130, 235, "请输入书籍的作者"); outtextxy(130, 285, "请输入书籍的出版社"); outtextxy(130, 335, "请输入书籍的数量"); outtextxy(125, 435, "继续添加"); outtextxy(435, 435, " 退出");
bookmessage a; char tempprice[20]; char tempnum[10];
InputBox(a.name, 50, "请输入书籍的名称"); outtextxy(335, 135, a.name); InputBox(tempprice, 20, "请输入书籍的价格"); outtextxy(335, 185, tempprice); a.price = atoi(tempprice); InputBox(a.author, 50, "请输入书籍的作者"); outtextxy(335, 235, a.author); InputBox(a.chubanshe,50, "请输入书籍的出版社"); outtextxy(335, 285, a.chubanshe); InputBox(tempnum, 10, "请输入书籍的数量"); outtextxy(335, 335, tempnum); a.jieyue=0; a.num = atoi(tempnum); insertnodebyhead(list, a); saveinfotofile("book.txt", list); MessageBox(NULL, "添加成功", "来自z1in的提醒", MB_YESNO | MB_SYSTEMMODAL); MOUSEMSG msg; while (1) { msg = GetMouseMsg(); switch (msg.uMsg) { case WM_LBUTTONDOWN: if (msg.x >= 120 && msg.x <= 200 && msg.y >= 430 && msg.y <= 460) { closegraph(); goto zxy;
} else if (msg.x >= 430 && msg.x <= 510 && msg.y >= 430 && msg.y <= 460) { closegraph(); return; } } } }
int reb() { IMAGE backimg; IMAGE choiseimg; IMAGE selectimg;
system("cls"); int select; zxy:initgraph(640, 480); loadimage(&backimg, "004.jpg", 640, 480); loadimage(&choiseimg, "001.jfif", 420, 30); loadimage(&selectimg, "002.jfif", 80, 30);
putimage(0, 0, &backimg); putimage(130, 60, &choiseimg); putimage(130, 100, &choiseimg); putimage(130, 140, &choiseimg); putimage(130, 180, &choiseimg); putimage(130, 220, &choiseimg); putimage(130, 260, &choiseimg); putimage(130, 300, &choiseimg); putimage(130, 340, &choiseimg); putimage(140, 420, &selectimg); putimage(440, 420, &selectimg);
setbkmode(TRANSPARENT); setcolor(YELLOW); settextstyle(40, 0, "Century Gothic"); outtextxy(205, 10, "z1in图书管理系统"); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(140, 185, "请输入书籍的名称"); outtextxy(140, 225, "请输入书籍的价格"); outtextxy(140, 265, "请输入书籍的作者"); outtextxy(140, 305, "请输入书籍的出版社"); outtextxy(140, 345, "请输入书籍的数量"); outtextxy(145, 425, "继续修改"); outtextxy(445, 425, " 退出");
char tempprice[20]; char tempnum[10]; char name[40]; char tempstr[100];
InputBox(name, 40, "请输入想要修改的书籍的名称"); struct node* book = searchbyname(list, name); if (book != NULL) { MessageBox(NULL, "该书存在", "来自z1in的提醒", MB_OK | MB_SYSTEMMODAL); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(145, 65, "------------------------------图书信息-----------------------------"); outtextxy(145, 105, "书名 作者 出版社 单价 馆藏量 借阅数"); sprintf(tempstr, "%-10s %-10s %-14s %-10.1f %-14d %-6d\n", book->data.name, book->data.author, book->data.chubanshe, book->data.price, book->data.num, book->data.jieyue); outtextxy(145, 145, tempstr); Sleep(1500); InputBox(book->data.name, 50, "请输入书籍的名称"); outtextxy(345, 185, book->data.name); InputBox(tempprice, 20, "请输入书籍的价格"); outtextxy(345, 225, tempprice); book->data.price = atoi(tempprice); InputBox(book->data.author, 50, "请输入书籍的作者"); outtextxy(345, 265, book->data.author); InputBox(book->data.chubanshe, 50, "请输入书籍的出版社"); outtextxy(345, 305, book->data.chubanshe); InputBox(tempnum, 10, "请输入书籍的数量"); outtextxy(345, 345, tempnum); book->data.num = atoi(tempnum); saveinfotofile("book.txt", list); MessageBox(NULL, "修改成功", "来自z1in的提醒.", MB_OK | MB_SYSTEMMODAL); } else { MessageBox(NULL, TEXT("没有改书哦。"), TEXT("来自z1in的提醒."), MB_OK | MB_SYSTEMMODAL); } MOUSEMSG msg; while (1) { msg = GetMouseMsg(); switch (msg.uMsg) { case WM_LBUTTONDOWN: if (msg.x >= 100 && msg.x <= 180 && msg.y >= 420 && msg.y <= 450) { closegraph(); goto zxy;
} else if (msg.x >= 440 && msg.x <= 520 && msg.y >= 420 && msg.y <= 450) { closegraph(); return 0; } } } }
void deb() { IMAGE backimg; IMAGE choiseimg; IMAGE selectimg;
system("cls"); int select; zxy:initgraph(640, 480); loadimage(&backimg, "004.jpg", 640, 480); loadimage(&choiseimg, "001.jfif", 420, 30); loadimage(&selectimg, "002.jfif", 80, 30);
putimage(0, 0, &backimg); putimage(100, 130, &choiseimg); putimage(100, 180, &choiseimg); putimage(100, 230, &choiseimg); putimage(120, 430, &selectimg); putimage(430, 430, &selectimg);
setbkmode(TRANSPARENT); setcolor(YELLOW); settextstyle(40, 0, "Century Gothic"); outtextxy(205, 10, "z1in图书管理系统"); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(125, 435, " 删除"); outtextxy(435, 435, " 退出");
char name[20]; char tempstr[100]; InputBox(name, 20, "请输入您想删除的书本的名称"); struct node* book = searchbyname(list, name);
if (book != NULL) { setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(105, 135, "------------------------------图书信息-----------------------------"); outtextxy(105, 185, "书名 作者 出版社 单价 馆藏量 借阅数"); sprintf(tempstr, "%-10s %-10s %-14s %-10.1f %-14d %-6d\n", book->data.name, book->data.author, book->data.chubanshe, book->data.price, book->data.num, book->data.jieyue); outtextxy(105, 235, tempstr);
deletenotebyname(list, name); saveinfotofile("book.txt", list); MessageBox(NULL, "删除成功", "来自z1in的提醒.", MB_OK | MB_SYSTEMMODAL); } else MessageBox(NULL, "没有您想删除的的书籍哦.", "来自z1in的提醒.", MB_OK | MB_SYSTEMMODAL);
MOUSEMSG msg; while (1) { msg = GetMouseMsg(); switch (msg.uMsg) { case WM_LBUTTONDOWN: if (msg.x >= 100 && msg.x <= 180 && msg.y >= 420 && msg.y <= 450) { closegraph(); goto zxy; } else if (msg.x >= 440 && msg.x <= 520 && msg.y >= 420 && msg.y <= 450) { closegraph(); return; } } } }
void showseb(struct node* book) { IMAGE backimg; IMAGE choiseimg; system("cls"); int select; initgraph(640, 480); loadimage(&backimg, "004.jpg", 640, 480); loadimage(&choiseimg, "001.jfif", 420, 30); putimage(0, 0, &backimg); putimage(120, 130, &choiseimg); putimage(120, 180, &choiseimg); putimage(120, 230, &choiseimg); putimage(120, 430, &choiseimg);
setbkmode(TRANSPARENT); setcolor(YELLOW); settextstyle(40, 0, "Century Gothic"); outtextxy(205, 10, "z1in图书管理系统"); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(315, 435, "退出");
char tempstr[100];
sprintf(tempstr, "%-10s %-10s %-14s %-10.1f %-14d %-6d\n", book->data.name, book->data.author, book->data.chubanshe, book->data.price, book->data.num, book->data.jieyue); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(135, 135, "------------------------------图书信息-----------------------------"); outtextxy(135, 185, "书名 作者 出版社 单价 馆藏量 借阅数"); outtextxy(135, 235, tempstr); MOUSEMSG msg; while (1) { msg = GetMouseMsg(); switch (msg.uMsg) { case WM_LBUTTONDOWN: if (msg.x >= 120 && msg.x <= 540 && msg.y >= 430 && msg.y <= 460) { closegraph(); return; } } } }
int seb() { IMAGE backimg; IMAGE choiseimg; IMAGE selectimg;
system("cls"); zxy:initgraph(640, 480); loadimage(&backimg, "004.jpg", 640, 480); loadimage(&choiseimg, "001.jfif", 220, 30); loadimage(&selectimg, "002.jfif", 80, 30);
putimage(0, 0, &backimg); putimage(220, 130, &choiseimg); putimage(220, 180, &choiseimg); putimage(220, 230, &choiseimg); putimage(120, 430, &selectimg); putimage(430, 430, &selectimg);
setbkmode(TRANSPARENT); setcolor(YELLOW); settextstyle(40, 0, "Century Gothic"); outtextxy(205, 10, "z1in图书管理系统"); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(265, 135, "通过书名查询"); outtextxy(265, 185, "通过书的作者查询"); outtextxy(265, 235, "通过书的出版社查询"); outtextxy(125, 435, " 刷新"); outtextxy(435, 435, " 退出");
int select; char name[40]; MOUSEMSG msg; while (1) { msg = GetMouseMsg(); switch (msg.uMsg) { case WM_LBUTTONDOWN: if (msg.x >= 220 && msg.x <= 440 && msg.y >= 130 && msg.y <= 160) { InputBox(name, 40, "请输入书籍名称"); struct node* book = searchbyname(list, name); if (book != NULL) { MessageBox(NULL, "查询成功", "来自z1in的提醒.", MB_OK | MB_SYSTEMMODAL); closegraph(); showseb(book); } else { MessageBox(NULL, TEXT("没有该书哦。"), TEXT("来自z1in的提醒."), MB_OK | MB_SYSTEMMODAL); } goto zxy; } else if (msg.x >= 220 && msg.x <= 440 && msg.y >= 180 && msg.y <= 210) { InputBox(name, 40, "请输入作者名称"); struct node* book = searchbyauthor(list, name); if (book != NULL) { MessageBox(NULL, "查询成功", "来自z1in的提醒.", MB_OK | MB_SYSTEMMODAL); closegraph(); showseb(book); } else { MessageBox(NULL, TEXT("没有改书哦。"), TEXT("来自z1in的提醒."), MB_OK | MB_SYSTEMMODAL); } goto zxy; } else if (msg.x >= 220 && msg.x <= 440 && msg.y >= 230 && msg.y <= 260) { InputBox(name, 40, "请输入出版社名称"); struct node* book = searchbychubanshe(list, name); if (book != NULL) { MessageBox(NULL, "查询成功", "来自z1in的提醒.", MB_OK | MB_SYSTEMMODAL); closegraph(); showseb(book); } else { MessageBox(NULL, TEXT("没有该书哦。"), TEXT("来自z1in的提醒."), MB_OK | MB_SYSTEMMODAL); } goto zxy; } else if (msg.x >= 120 && msg.x <= 200 && msg.y >= 430 && msg.y <= 460) { closegraph(); goto zxy; } else if (msg.x >= 430 && msg.x <= 510 && msg.y >= 430 && msg.y <= 460) { closegraph(); return 0; } } } }
void adp() { IMAGE backimg; IMAGE choiseimg; IMAGE selectimg;
system("cls"); int select; zxy:initgraph(640, 480); loadimage(&backimg, "004.jpg", 640, 480); loadimage(&choiseimg, "001.jfif", 420, 30); loadimage(&selectimg, "002.jfif", 80, 30);
putimage(0, 0, &backimg); putimage(100, 130, &choiseimg); putimage(100, 180, &choiseimg); putimage(100, 230, &choiseimg); putimage(100, 280, &choiseimg); putimage(120, 430, &selectimg); putimage(430, 430, &selectimg);
setbkmode(TRANSPARENT); setcolor(YELLOW); settextstyle(40, 0, "Century Gothic"); outtextxy(205, 10, "z1in图书管理系统"); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(130, 135, "请输入读者的学号"); outtextxy(130, 185, "请输入读者的姓名"); outtextxy(130, 235, "请输入读者的性别"); outtextxy(130, 285, "请输入读者的账号密码"); outtextxy(125, 435, "继续添加"); outtextxy(435, 435, " 退出");
personmessage a; char tempnumber[20];
InputBox(a.zhanghao.schoolnumber, 50, "请输入读者的学号"); outtextxy(335, 135, a.zhanghao.schoolnumber); InputBox(a.zhanghao.name, 20, "请输入读者的姓名"); outtextxy(335, 185, a.zhanghao.name); InputBox(a.zhanghao.sex, 50, "请输入读者的性别"); outtextxy(335, 235, a.zhanghao.sex); InputBox(a.password, 50, "请输入读者的账号密码"); outtextxy(335, 285, a.password); a.zhanghao.many = 0; strcpy(a.zhanghao.book[0].name, "0"); strcpy(a.zhanghao.book[1].name, "0"); strcpy(a.zhanghao.book[2].name, "0"); a.zhanghao.book[0].time = 0; a.zhanghao.book[1].time = 0; a.zhanghao.book[2].time = 0; peinsertnodebyhead(pelist, a); pesaveinfotofile("person.txt", pelist); MessageBox(NULL, "添加成功", "来自z1in的提醒", MB_YESNO | MB_SYSTEMMODAL); MOUSEMSG msg; while (1) { msg = GetMouseMsg(); switch (msg.uMsg) { case WM_LBUTTONDOWN: if (msg.x >= 120 && msg.x <= 200 && msg.y >= 430 && msg.y <= 460) { closegraph(); goto zxy;
} else if (msg.x >= 430 && msg.x <= 510 && msg.y >= 430 && msg.y <= 460) { closegraph(); return; } } } }
int rep() { IMAGE backimg; IMAGE choiseimg; IMAGE selectimg;
system("cls"); int select; zxy:initgraph(640, 480); loadimage(&backimg, "004.jpg", 640, 480); loadimage(&choiseimg, "001.jfif", 420, 30); loadimage(&selectimg, "002.jfif", 80, 30);
putimage(0, 0, &backimg); putimage(100, 130, &choiseimg); putimage(100, 180, &choiseimg); putimage(100, 230, &choiseimg); putimage(100, 280, &choiseimg); putimage(120, 430, &selectimg); putimage(430, 430, &selectimg);
setbkmode(TRANSPARENT); setcolor(YELLOW); settextstyle(40, 0, "Century Gothic"); outtextxy(205, 10, "z1in图书管理系统"); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(130, 135, "请输入读者的学号"); outtextxy(130, 185, "请输入读者的姓名"); outtextxy(130, 235, "请输入读者的性别"); outtextxy(130, 285, "请输入读者的账号密码"); outtextxy(125, 435, "继续添加"); outtextxy(435, 435, " 退出");
char tempnumber[50]; char tempnum[10]; char name[40]; char tempstr[100]; InputBox(name, 40, "请输入想修改的读者的姓名."); struct node_pe* person = pesearchbyname(pelist, name);
if (person != NULL) { MessageBox(NULL, "该读者存在", "来自z1in的提醒.", MB_OK | MB_SYSTEMMODAL); InputBox(person->data.zhanghao.schoolnumber, 50, "请输入读者的学号"); outtextxy(335, 135, person->data.zhanghao.schoolnumber); InputBox(person->data.zhanghao.name, 30, "请输入读者的姓名"); outtextxy(335, 185, person->data.zhanghao.name); InputBox(person->data.zhanghao.sex, 20, "请输入读者的性别"); outtextxy(335, 235, person->data.zhanghao.sex); InputBox(person->data.password, 20, "请输入读者的账号密码"); outtextxy(335, 285, person->data.password); pesaveinfotofile("person.txt", pelist); MessageBox(NULL, "修改成功", "来自z1in的提醒.", MB_OK | MB_SYSTEMMODAL); } else { MessageBox(NULL, TEXT("没有改读者哦。"), TEXT("提示框"), MB_OK | MB_SYSTEMMODAL); } MOUSEMSG msg; while (1) { msg = GetMouseMsg(); switch (msg.uMsg) { case WM_LBUTTONDOWN: if (msg.x >= 100 && msg.x <= 180 && msg.y >= 420 && msg.y <= 450) { closegraph(); goto zxy; } else if (msg.x >= 440 && msg.x <= 520 && msg.y >= 420 && msg.y <= 450) { closegraph(); return 0; } } } }
int dep() { IMAGE backimg; IMAGE choiseimg; IMAGE selectimg;
system("cls"); int select; zxy:initgraph(640, 480); loadimage(&backimg, "004.jpg", 640, 480); loadimage(&choiseimg, "001.jfif", 420, 30); loadimage(&selectimg, "002.jfif", 80, 30);
putimage(0, 0, &backimg); putimage(100, 130, &choiseimg); putimage(100, 180, &choiseimg); putimage(100, 230, &choiseimg); putimage(100, 280, &choiseimg); putimage(120, 430, &selectimg); putimage(430, 430, &selectimg);
setbkmode(TRANSPARENT); setcolor(YELLOW); settextstyle(40, 0, "Century Gothic"); outtextxy(205, 10, "z1in图书管理系统"); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(280, 135, "读者的信息"); outtextxy(125, 435, "继续删除"); outtextxy(435, 435, " 退出");
char name[20]; char tempstr[100];
InputBox(name, 20, "请输入您想删除的读者的姓名"); struct node_pe* person = pesearchbyname(pelist, name); if (person != NULL) { MessageBox(NULL, "该读者存在", "来自z1in的提醒", MB_OK | MB_SYSTEMMODAL); outtextxy(205,185,"-----------------读者信息-------------------\n"); outtextxy(205,235,"学号 姓名 性别 \n"); sprintf(tempstr, "%-19d %-14s %-8s \n", person->data.zhanghao.schoolnumber, person->data.zhanghao.name, person->data.zhanghao.sex); outtextxy(205, 285, tempstr); int i = MessageBox(NULL, "确认删除吗?", "来自z1in的提醒.", MB_YESNO | MB_SYSTEMMODAL); if (i == 6) { pedeletenotebyname(pelist, name); pesaveinfotofile("person.txt", pelist); MessageBox(NULL, "读者删除成功", "来自z1in的提醒.", MB_OK | MB_SYSTEMMODAL); } } else MessageBox(NULL, "您想删除的读者不存在!", "来自z1in的提醒.", MB_OK | MB_SYSTEMMODAL); MOUSEMSG msg; while (1) { msg = GetMouseMsg(); switch (msg.uMsg) { case WM_LBUTTONDOWN: if (msg.x >= 100 && msg.x <= 180 && msg.y >= 420 && msg.y <= 450) { goto zxy; closegraph(); } else if (msg.x >= 440 && msg.x <= 520 && msg.y >= 420 && msg.y <= 450) { closegraph(); return 0; } } } }
void showsep(struct node_pe* person) { IMAGE backimg; IMAGE choiseimg; system("cls"); int select; initgraph(640, 480); loadimage(&backimg, "004.jpg", 640, 480); loadimage(&choiseimg, "001.jfif", 420, 30); putimage(0, 0, &backimg); putimage(120, 130, &choiseimg); putimage(120, 180, &choiseimg); putimage(120, 230, &choiseimg); putimage(120, 430, &choiseimg);
setbkmode(TRANSPARENT); setcolor(YELLOW); settextstyle(40, 0, "Century Gothic"); outtextxy(205, 10, "z1in图书管理系统"); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(315, 435, "退出");
char tempstr[100];
sprintf(tempstr, "%-19s %-14s %-8s \n", person->data.zhanghao.schoolnumber, person->data.zhanghao.name, person->data.zhanghao.sex); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(205, 135, "-----------------读者信息-------------------\n"); outtextxy(205, 185, "学号 姓名 性别 \n"); outtextxy(205, 235, tempstr);
MOUSEMSG msg; while (1) { msg = GetMouseMsg(); switch (msg.uMsg) { case WM_LBUTTONDOWN: if (msg.x >= 120 && msg.x <= 540 && msg.y >= 430 && msg.y <= 460) { closegraph(); return; } } } }
int sep() { IMAGE backimg; IMAGE choiseimg; IMAGE selectimg;
system("cls"); zxy:initgraph(640, 480); loadimage(&backimg, "004.jpg", 640, 480); loadimage(&choiseimg, "001.jfif", 220, 30); loadimage(&selectimg, "002.jfif", 80, 30);
putimage(0, 0, &backimg); putimage(220, 130, &choiseimg); putimage(220, 180, &choiseimg); putimage(120, 430, &selectimg); putimage(430, 430, &selectimg);
setbkmode(TRANSPARENT); setcolor(YELLOW); settextstyle(40, 0, "Century Gothic"); outtextxy(205, 10, "z1in图书管理系统"); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(265, 135, "通过读者姓名查询"); outtextxy(265, 185, "通过读者学号查询"); outtextxy(125, 435, " 刷新"); outtextxy(435, 435, " 退出");
int select; char name[40]; char number[30];
MOUSEMSG msg; while (1) { msg = GetMouseMsg(); switch (msg.uMsg) { case WM_LBUTTONDOWN: if (msg.x >= 220 && msg.x <= 440 && msg.y >= 130 && msg.y <= 160) { InputBox(name, 40, "请输入读者姓名"); struct node_pe* person = pesearchbyname(pelist, name); if (person != NULL) { MessageBox(NULL, "查询成功", "来自z1in的提醒.", MB_OK | MB_SYSTEMMODAL); closegraph(); showsep(person); } else { MessageBox(NULL, TEXT("没有该读者哦。"), TEXT("来自z1in的提醒."), MB_OK | MB_SYSTEMMODAL); } goto zxy; } else if (msg.x >= 220 && msg.x <= 440 && msg.y >= 180 && msg.y <= 210) { InputBox(number, 30, "请输入读者学号"); struct node_pe* person = pesearchbynumber(pelist, number); if (person != NULL) { MessageBox(NULL, "查询成功", "来自z1in的提醒.", MB_OK | MB_SYSTEMMODAL); closegraph(); showsep(person); } else { MessageBox(NULL, TEXT("没有改读者哦。"), TEXT("来自z1in的提醒."), MB_OK | MB_SYSTEMMODAL); } goto zxy; } else if (msg.x >= 120 && msg.x <= 200 && msg.y >= 430 && msg.y <= 460) { closegraph(); goto zxy; } else if (msg.x >= 430 && msg.x <= 510 && msg.y >= 430 && msg.y <= 460) { closegraph(); return 0; } } } }
int rogin() { char console[20] = "1234563"; system("cls"); initgraph(640, 480); loadimage(&backimg, "004.jpg", 720, 1280); loadimage(&choiseimg, "001.jfif", 220, 30); putimage(0, 0, &backimg); putimage(220, 130, &choiseimg); putimage(220, 180, &choiseimg); putimage(220, 230, &choiseimg); setbkmode(TRANSPARENT); setcolor(YELLOW); settextstyle(40, 0, "Century Gothic"); outtextxy(205, 10, "z1in图书管理系统"); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(265, 135, " 管 理 员 登 陆"); outtextxy(265, 185, " 读 者 登 录"); outtextxy(265, 235, " 退 出 ");
int select; int select_; zxy:select = select = MessageBox(NULL, "您需要获得管理员权限,是否登陆管理员.", "来自z1in的提醒:", MB_YESNO | MB_SYSTEMMODAL); char crypto[20]="0"; for (;;) { if (select == 6 ) { InputBox(crypto, 20, "请输入管理员密钥:"); if (strcmp(crypto,console) !=0 ) { zxy_:select_ = MessageBox(NULL, "密钥不正确,是否继续登录.", "来自z1in的提醒.", MB_YESNO | MB_SYSTEMMODAL); for (;;) { if (select_ == 6 ) { select = 6; break; } else if (select_ == 7 ) { select = 7; return 0; } } } else { return 1; } } else if (select == 7 ) { return 0; } } }
int jieshu(struct node_pe*** reader) { IMAGE backimg; IMAGE choiseimg; system("cls"); int select; initgraph(640, 480); loadimage(&backimg, "004.jpg", 640, 480); loadimage(&choiseimg, "001.jfif", 420, 30); putimage(0, 0, &backimg); putimage(120, 130, &choiseimg); putimage(120, 180, &choiseimg); putimage(120, 230, &choiseimg); putimage(120, 430, &choiseimg);
setbkmode(TRANSPARENT); setcolor(YELLOW); settextstyle(40, 0, "Century Gothic"); outtextxy(205, 10, "z1in图书管理系统"); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(315, 435, "退出"); char tempbook[40]; char tempstr[60]; InputBox(tempbook, 40, "请输入您想借阅的书籍"); struct node* book = searchbyname(list, tempbook); if (book != NULL ) { if ((**reader)->data.zhanghao.many < 3 && book->data.num>0) { time_t b = time(NULL); strcpy((**reader)->data.zhanghao.book[(**reader)->data.zhanghao.many].name, book->data.name); (**reader)->data.zhanghao.book[(**reader)->data.zhanghao.many].time = b %1000000; (**reader)->data.zhanghao.many++; book->data.num--; book->data.jieyue++; sprintf(tempstr, "借阅成功,您当前已借阅%d本,还可借阅%d本,记得及时还书哦!\n", (**reader)->data.zhanghao.many, (3 - (**reader)->data.zhanghao.many)); MessageBox(NULL, tempstr, "来自z1in的提醒", MB_OK | MB_SYSTEMMODAL); sprintf(tempstr, "%-10s %-10s %-14s %-10.1f %-14d %-6d\n", book->data.name, book->data.author, book->data.chubanshe, book->data.price, book->data.num, book->data.jieyue); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(135, 135, "------------------------------图书信息-----------------------------"); outtextxy(135, 185, "书名 作者 出版社 单价 馆藏量 借阅数"); outtextxy(135, 235, tempstr); } else MessageBox(NULL, "您的借阅本书以达到上限, 看完书再来借哦", "来自z1in的提醒", MB_OK | MB_SYSTEMMODAL); } else MessageBox(NULL, "暂时没有该书哦,可以向管理员反应哦", "来自z1in的提醒", MB_OK | MB_SYSTEMMODAL);
MOUSEMSG msg; while (1) { msg = GetMouseMsg(); switch (msg.uMsg) { case WM_LBUTTONDOWN: if (msg.x >= 120 && msg.x <= 540 && msg.y >= 430 && msg.y <= 460) { closegraph(); return 0; } } } }
int huanshu(struct node_pe*** reader) { IMAGE backimg; IMAGE choiseimg; IMAGE selectimg; system("cls"); int select; initgraph(640, 480); loadimage(&backimg, "004.jpg", 640, 480); loadimage(&choiseimg, "001.jfif", 420, 30); loadimage(&selectimg, "002.jfif", 60, 30); putimage(0, 0, &backimg); putimage(120, 80, &choiseimg); putimage(120, 130, &choiseimg); putimage(120, 180, &choiseimg); putimage(120, 230, &choiseimg); putimage(120, 430, &selectimg); putimage(490, 430, &selectimg);
setbkmode(TRANSPARENT); setcolor(YELLOW); settextstyle(40, 0, "Century Gothic"); outtextxy(205, 10, "z1in图书管理系统"); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(125, 435, "还书"); outtextxy(495, 435, "退出"); char tempstr[100];
if ((**reader)->data.zhanghao.many != 0) { outtextxy(275, 85, "您已借阅的书籍"); settextstyle(20, 0, "Century Gothic"); outtextxy(135, 135, "------------------------------图书信息-----------------------------"); outtextxy(135, 185, "书名 作者 出版社 单价 馆藏量 借阅数"); int x = 0; for (int i = 0; i < 3; i++) { if (searchbyname(list, (**reader)->data.zhanghao.book[i].name) != NULL) { node* tempbook = searchbyname(list, (**reader)->data.zhanghao.book[i].name); sprintf(tempstr, "%-10s %-10s %-14s %-10.1f %-14d %-6d\n", tempbook->data.name, tempbook->data.author, tempbook->data.chubanshe, tempbook->data.price, tempbook->data.num, tempbook->data.jieyue); outtextxy(135, 235 + x, tempstr); x += 50; putimage(120, 230+x, &choiseimg); } } char tempbook[30]; int flag = 1; int flag1 = 0; MOUSEMSG msg; while (1) { msg = GetMouseMsg(); switch (msg.uMsg) { case WM_LBUTTONDOWN: if (msg.x >= 120 && msg.x <= 180 && msg.y >= 430 && msg.y <= 460) { InputBox(tempbook, 30, "请输入您要归还的书籍名称"); for (int i = 0; i < 3; i++) { if (strcmp((**reader)->data.zhanghao.book[i].name, tempbook) == 0) { time_t b = time(NULL); char qingkong[30] = { "0" }; strcpy((**reader)->data.zhanghao.book[i].name, qingkong); dif((**reader)->data.zhanghao.book[i].time); (**reader)->data.zhanghao.many--; (**reader)->data.zhanghao.book[i].time = 0; struct node* book1 = searchbyname(list, tempbook); book1->data.num++; MessageBox(NULL, "您已归还成功.", "来自z1in的提醒.", MB_OK | MB_SYSTEMMODAL); break; } else if (i == 3) { MessageBox(NULL, "您并没有借阅该书哦.", "来自z1in的提醒.", MB_OK | MB_SYSTEMMODAL); break; } } } if (msg.x >= 490 && msg.x <= 550 && msg.y >= 430 && msg.y <= 460) { closegraph(); return 0; } } } } else MessageBox(NULL, "您没有未归还的书籍哦.", "来自z1in的提醒.", MB_OK | MB_SYSTEMMODAL); return 0; }
int xujie(struct node_pe*** reader) { IMAGE backimg; IMAGE choiseimg; IMAGE selectimg; system("cls"); int select; initgraph(640, 480); loadimage(&backimg, "004.jpg", 640, 480); loadimage(&choiseimg, "001.jfif", 420, 30); loadimage(&selectimg, "002.jfif", 60, 30); putimage(0, 0, &backimg); putimage(120, 130, &choiseimg); putimage(120, 180, &choiseimg); putimage(120, 230, &choiseimg); putimage(120, 280, &choiseimg); putimage(120, 430, &selectimg); putimage(490, 430, &selectimg);
setbkmode(TRANSPARENT); setcolor(YELLOW); settextstyle(40, 0, "Century Gothic"); outtextxy(205, 10, "z1in图书管理系统"); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(125, 435, "续借"); outtextxy(495, 435, "退出"); int i = 0; int flag = 0; char tempname[40]; char tempbook[30]; char tempstr[100]; if ((**reader)->data.zhanghao.many != 0) { outtextxy(275, 135, "您已借阅的书籍"); settextstyle(20, 0, "Century Gothic"); outtextxy(135, 185, "------------------------------图书信息-----------------------------"); outtextxy(135, 235, "书名 作者 出版社 单价 馆藏量 借阅数"); int x = 0; for (int i = 0; i < 3; i++) { if (searchbyname(list, (**reader)->data.zhanghao.book[i].name) != NULL) { node* tempbook = searchbyname(list, (**reader)->data.zhanghao.book[i].name); sprintf(tempstr, "%-10s %-10s %-14s %-10.1f %-14d %-6d\n", tempbook->data.name, tempbook->data.author, tempbook->data.chubanshe, tempbook->data.price, tempbook->data.num, tempbook->data.jieyue); outtextxy(135, 285 + x, tempstr); x += 50; putimage(120, 280 + x, &choiseimg); } } MOUSEMSG msg; while (1) { msg = GetMouseMsg(); switch (msg.uMsg) { case WM_LBUTTONDOWN: if (msg.x >= 120 && msg.x <= 180 && msg.y >= 430 && msg.y <= 460) { InputBox(tempbook, 30, "请输入您要续借的书籍名称"); for (int i = 0; i < 3; i++) { if (strcmp((**reader)->data.zhanghao.book[i].name, tempbook) == 0) { (**reader)->data.zhanghao.book[i].time = 0; MessageBox(NULL, "您已续借成功.", "来自z1in的提醒.", MB_OK | MB_SYSTEMMODAL); flag += 1; } } if (flag == 0) { MessageBox(NULL, "您并没有借阅该书哦.", "来自z1in的提醒.", MB_OK | MB_SYSTEMMODAL); } } if (msg.x >= 490 && msg.x <= 550 && msg.y >= 430 && msg.y <= 460) { closegraph(); return 0; } } } } else MessageBox(NULL, "您还没有未归还的书哦.", "来自z1in的提醒.", MB_OK | MB_SYSTEMMODAL); }
void popular(struct node* list) { bubblesort(list); printflist(list); return; }
void tuijian(struct node* list) { IMAGE backimg; IMAGE choiseimg; IMAGE selectimg; system("cls"); int select; initgraph(640, 480); loadimage(&backimg, "004.jpg", 640, 480); loadimage(&choiseimg, "001.jfif", 420, 30); loadimage(&selectimg, "002.jfif", 80, 30); putimage(0, 0, &backimg); putimage(120, 130, &choiseimg); putimage(120, 180, &choiseimg); putimage(120, 230, &choiseimg); putimage(120, 280, &choiseimg); putimage(110, 430, &selectimg); putimage(490, 430, &selectimg);
setbkmode(TRANSPARENT); setcolor(YELLOW); settextstyle(40, 0, "Century Gothic"); outtextxy(205, 10, "z1in图书管理系统"); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(115, 435, "修改价位"); outtextxy(495, 435, "退出");
zxy:int flag = 0; char target[20]; char tempstr[100];
InputBox(target, 20, "请输入您的理想价格,我们将推荐与您理想价格稍低的书."); float idea = atoi(target); bubblesort(list); struct node* pmove = list->next; system("cls"); outtextxy(275, 135, "为您查询到以下书籍"); settextstyle(20, 0, "Century Gothic"); outtextxy(135, 185, "------------------------------图书信息-----------------------------"); outtextxy(135, 235, "书名 作者 出版社 单价 馆藏量 借阅数");
int x = 0;
while (pmove != NULL) { if (pmove->data.price <= idea && flag < 4) { sprintf(tempstr, "%-10s %-10s %-14s %-10.1f %-14d %-6d\n", pmove->data.name, pmove->data.author, pmove->data.chubanshe, pmove->data.price, pmove->data.num, pmove->data.jieyue); outtextxy(135, 285 + x, tempstr); x += 50; putimage(120, 280+x, &choiseimg); flag++; } pmove = pmove->next; } if (flag == 0) { MessageBox(NULL, "没有理想价位的书哦.", "来自z1in的提醒.", MB_OK | MB_SYSTEMMODAL); } MOUSEMSG msg; while (1) { msg = GetMouseMsg(); switch (msg.uMsg) { case WM_LBUTTONDOWN: if (msg.x >= 110 && msg.x <= 170 && msg.y >= 430 && msg.y <= 460) { goto zxy; } if (msg.x >= 490 && msg.x <= 550 && msg.y >= 430 && msg.y <= 460) { closegraph(); return; } } } }
void bookcon() { IMAGE backimg; IMAGE choiseimg; system("cls"); zxy:initgraph(640, 480); loadimage(&backimg, "004.jpg", 640, 480); loadimage(&choiseimg, "001.jfif", 220, 30); putimage(0, 0, &backimg); putimage(220, 130, &choiseimg); putimage(220, 180, &choiseimg); putimage(220, 230, &choiseimg); putimage(220, 280, &choiseimg); putimage(220, 330, &choiseimg);
setbkmode(TRANSPARENT); setcolor(YELLOW); settextstyle(40, 0, "Century Gothic"); outtextxy(205, 10, "z1in图书管理系统"); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(265, 135, " 增加图书"); outtextxy(265, 185, " 删除图书"); outtextxy(265, 235, " 更新图书"); outtextxy(265, 285, " 查询图书 "); outtextxy(265, 335, " 退 出 "); MOUSEMSG msg; while (1) { msg = GetMouseMsg(); switch (msg.uMsg) { case WM_LBUTTONDOWN: if (msg.x >= 220 && msg.x <= 420 && msg.y >= 130 && msg.y <= 160) { closegraph(); adb(); goto zxy; } else if (msg.x >= 220 && msg.x <= 420 && msg.y >= 180 && msg.y <= 210) { closegraph(); deb(); goto zxy; } else if (msg.x >= 220 && msg.x <= 440 && msg.y >= 230 && msg.y <= 260) { closegraph(); reb(); goto zxy; } else if (msg.x >= 220 && msg.x <= 420 && msg.y >= 280 && msg.y <= 310) { closegraph(); seb(); goto zxy; } else if (msg.x >= 220 && msg.x <= 440 && msg.y >= 330 && msg.y <= 360) { outtextxy(265, 335, " 退出中,请稍等...... "); closegraph(); return; } } } }
void personcon() { IMAGE backimg; IMAGE choiseimg; zxy:system("cls"); initgraph(640, 480); loadimage(&backimg, "004.jpg", 640, 480); loadimage(&choiseimg, "001.jfif", 220, 30); putimage(0, 0, &backimg); putimage(220, 130, &choiseimg); putimage(220, 180, &choiseimg); putimage(220, 230, &choiseimg); putimage(220, 280, &choiseimg); putimage(220, 330, &choiseimg);
setbkmode(TRANSPARENT); setcolor(YELLOW); settextstyle(40, 0, "Century Gothic"); outtextxy(205, 10, "z1in图书管理系统"); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(265, 135, " 增加读者"); outtextxy(265, 185, " 删除读者"); outtextxy(265, 235, " 更新读者"); outtextxy(265, 285, " 查询读者 "); outtextxy(265, 335, " 退 出 "); MOUSEMSG msg; while (1) { msg = GetMouseMsg(); switch (msg.uMsg) { case WM_LBUTTONDOWN: if (msg.x >= 220 && msg.x <= 420 && msg.y >= 130 && msg.y <= 160) { closegraph(); adp(); goto zxy; } else if (msg.x >= 220 && msg.x <= 420 && msg.y >= 180 && msg.y <= 210) { closegraph(); dep(); goto zxy; } else if (msg.x >= 220 && msg.x <= 440 && msg.y >= 230 && msg.y <= 260) { closegraph(); rep(); goto zxy; } else if (msg.x >= 220 && msg.x <= 420 && msg.y >= 280 && msg.y <= 310) { closegraph(); sep(); goto zxy; } else if (msg.x >= 220 && msg.x <= 440 && msg.y >= 330 && msg.y <= 360) { closegraph(); outtextxy(265, 335, " 退出中,请稍等...... "); return; } } } }
void readers(struct node_pe** reader) { zxy:IMAGE backimg; IMAGE choiseimg; system("cls"); int select; initgraph(640, 480); loadimage(&backimg, "004.jpg", 640, 480); loadimage(&choiseimg, "001.jfif", 220, 30); putimage(0, 0, &backimg); putimage(220, 130, &choiseimg); putimage(220, 180, &choiseimg); putimage(220, 230, &choiseimg); putimage(220, 280, &choiseimg); putimage(220, 330, &choiseimg); putimage(220, 380, &choiseimg); setbkmode(TRANSPARENT); setcolor(YELLOW); settextstyle(40, 0, "Century Gothic"); outtextxy(205, 10, "z1in图书管理系统"); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(265, 135, " 借书"); outtextxy(265, 185, " 还书"); outtextxy(265, 235, " 续借"); outtextxy(255, 285, " 图书受欢迎度排行榜"); outtextxy(255, 335, " 价位书籍推荐"); outtextxy(265, 385, " 退出 "); MOUSEMSG msg; while (1) { msg = GetMouseMsg(); switch (msg.uMsg) { case WM_LBUTTONDOWN: if (msg.x >= 220 && msg.x <= 420 && msg.y >= 130 && msg.y <= 160) { closegraph(); jieshu(&reader); goto zxy; } else if (msg.x >= 220 && msg.x <= 420 && msg.y >= 180 && msg.y <= 210) { closegraph(); huanshu(&reader); goto zxy; } else if (msg.x >= 220 && msg.x <= 440 && msg.y >= 230 && msg.y <= 260) { closegraph(); xujie(&reader); goto zxy; } else if (msg.x >= 220 && msg.x <= 420 && msg.y >= 280 && msg.y <= 310) { closegraph(); popular(list); goto zxy; } else if (msg.x >= 220 && msg.x <= 440 && msg.y >= 330 && msg.y <= 360) { closegraph(); tuijian(list); goto zxy; } else if (msg.x >= 220 && msg.x <= 420 && msg.y >= 380 && msg.y <= 410) { closegraph(); return; } } } }
struct personmessage register_() { IMAGE backimg; IMAGE choiseimg; system("cls"); int select; initgraph(640, 480); loadimage(&backimg, "004.jpg", 640, 480); loadimage(&choiseimg, "001.jfif", 420, 30);
putimage(0, 0, &backimg); putimage(100, 130, &choiseimg); putimage(100, 180, &choiseimg); putimage(100, 230, &choiseimg);
setbkmode(TRANSPARENT); setcolor(YELLOW); settextstyle(40, 0, "Century Gothic"); outtextxy(205, 10, "z1in图书管理系统"); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(130, 135, "请输入您的姓名"); outtextxy(130, 185, "请输入您的性别"); outtextxy(130, 235, "请输入您的账户密码 ");
int flag = 1; int flag1 = 1; char tempnumber[20]; char crypto[20]; struct personmessage reader; system("cls"); password_circle(); fflush(stdin); char number[30]; InputBox(number, 30, "请输入您的学号:"); if (pesearchbynumber(pelist, number) != NULL) { while (flag) { system("cls"); struct node_pe* pereader = pesearchbynumber(pelist, number); InputBox(crypto, 20, "请输入您的密码:"); if (strcmp(crypto,pereader->data.password)==0) { flag = 0; MessageBox(NULL, "您已成功登录","来自z1in的提醒:",MB_OK | MB_SYSTEMMODAL); readers(&pereader); pesaveinfotofile("person.txt", pelist); saveinfotofile("book.txt", list); } else { int select = MessageBox(NULL, "密码错误,是否继续登录.", "来自z1in的提醒", MB_YESNO | MB_SYSTEMMODAL); if (select == 6) flag = 1; else if (select == 7) flag = 0; } } } else { MessageBox(NULL, "该账户还未注册,请先注册", "来自z1in的提醒.", MB_OK | MB_SYSTEMMODAL); strcpy(reader.zhanghao.schoolnumber, number); char ch; int x = 350; InputBox(reader.zhanghao.name, 30, "请输入您的姓名"); outtextxy(335, 135, reader.zhanghao.name); InputBox(reader.zhanghao.sex, 20, "请输入您的性别"); outtextxy(335, 185, reader.zhanghao.sex); InputBox(reader.password, 20, "请输入您的账户密码"); outtextxy(335, 235, reader.password); reader.zhanghao.many = 0; strcpy(reader.zhanghao.book[0].name, "0"); strcpy(reader.zhanghao.book[1].name, "0"); strcpy(reader.zhanghao.book[2].name, "0"); reader.zhanghao.book[0].time = 0; reader.zhanghao.book[1].time = 0; reader.zhanghao.book[2].time = 0; settextstyle(25, 0, "Century Gothic"); setcolor(YELLOW); outtextxy(155, 400, "注册成功,正在返回中,请稍后......."); Sleep(2000); closegraph(); peinsertnodebyhead(pelist, reader); struct node_pe* pereader = pesearchbynumber(pelist,number); readers(&pereader); pesaveinfotofile("person.txt", pelist); saveinfotofile("book.txt", list); } return reader; }
void quit() { int select; cout << "您确定要退出吗?" << "是/y,否/n" << endl; for(;;) { select = _getch(); if (select == 'y') exit(0); else if (select == 'n') break; else cout << "输入不正确,请重新输入" << endl; } system("cls"); }
int login() { system("cls"); int select; zxy:initgraph(640, 480); loadimage(&backimg, "004.jpg", 640, 480); loadimage(&choiseimg, "001.jfif", 220, 30); putimage(0, 0, &backimg); putimage(220, 130, &choiseimg); putimage(220, 180, &choiseimg); putimage(220, 230, &choiseimg); putimage(220, 280, &choiseimg);
setbkmode(TRANSPARENT); setcolor(YELLOW); settextstyle(40, 0, "Century Gothic"); outtextxy(205, 10, "z1in图书管理系统"); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(265, 135, " 管 理 员 登 陆"); outtextxy(265, 185, " 读 者 登 录"); outtextxy(265, 235, " 退 出 "); outtextxy(265, 285, " about me"); MOUSEMSG msg; while (1) { msg = GetMouseMsg(); switch (msg.uMsg) { case WM_LBUTTONDOWN: if (msg.x >= 220 && msg.x <= 420 && msg.y >= 130 && msg.y <= 160) { closegraph(); int i = rogin(); if (i == 1) { MessageBoxA(NULL, "您已成功登陆管理员。", "来自z1in的提醒",MB_OK | MB_SYSTEMMODAL); return 1; } } else if (msg.x >= 220 && msg.x <= 420 && msg.y >= 180 && msg.y <= 210) { closegraph(); register_(); return -1;; } else if (msg.x >= 220 && msg.x <= 440 && msg.y >= 230 && msg.y <= 260) { closegraph(); exit(0); } else if (msg.x >= 220 && msg.x <= 440 && msg.y >= 280 && msg.y <= 310) { closegraph(); aboutme(); goto zxy; } } } }
int main() {
list = creathead(); pelist = creatpehead(); readinfofromfile("book.txt", list); pereadinfofromfile("person.txt", pelist); showpower(); system("cls"); zxy:int i = login(); int select; while (1) { if (i == 1) { system("cls"); zxy1:initgraph(640, 480); loadimage(&backimg, "004.jpg", 640, 480); loadimage(&choiseimg, "001.jfif", 220, 30); putimage(0, 0, &backimg); putimage(220, 130, &choiseimg); putimage(220, 180, &choiseimg); putimage(220, 230, &choiseimg);
setbkmode(TRANSPARENT); setcolor(YELLOW); settextstyle(40, 0, "Century Gothic"); outtextxy(205, 10, "z1in图书管理系统"); setcolor(BLUE); settextstyle(20, 0, "Century Gothic"); outtextxy(265, 135, " 图 书 管 理"); outtextxy(265, 185, " 读 者 管 理"); outtextxy(265, 235, " 退 出 "); MOUSEMSG msg; while (1) { msg = GetMouseMsg(); switch (msg.uMsg) { case WM_LBUTTONDOWN: if (msg.x >= 220 && msg.x <= 420 && msg.y >= 130 && msg.y <= 160) { closegraph(); bookcon(); goto zxy1; } else if (msg.x >= 220 && msg.x <= 420 && msg.y >= 180 && msg.y <= 210) { closegraph(); personcon(); goto zxy1; } else if (msg.x >= 220 && msg.x <= 440 && msg.y >= 230 && msg.y <= 260) { closegraph(); goto zxy; } } } } else if (i == -1) {
goto zxy; } } return 0; }
}
|