概述
主要包括图书的库存信息,每一本书的借阅信息以及每个人的借书信息。
系统功能:
(1)借阅资料管理(对相关资料进行添加,删除,修改,查询等操做)
(2)借阅管理(包括借出操做,还书操做)
(3)读者管理(读者等级:可分为教师,学生。并定义每类读者可借书数量)
(4)统计分析(当前借阅和相关资料状态。统计分析借阅排行榜,资料状态统计,借阅统计,显示全部至当日到期未还书信息等功能分析)ios
若是以为链表麻烦的话能够使用(数组+文件):https://blog.csdn.net/qq_30253757/article/details/85341155数据库
管理员用户名和密码都是adminwindows
#include <iostream> #include <cstdio> #include <cstring> #include <string> #include <cmath> #include <cstring> #include <windows.h> #include <ctime> #include <cstdlib> using namespace std; typedef struct books //书籍编号————(做者,名称,出版时间,价格)与书籍编号一一对应,不然为新一类书 { //数量 int book_id; char author[50], book_name[50]; int time, count; double price; struct books *next; } BOOK, *Pbook; typedef struct have_been_borrowed //已借出的图书信息,书籍编号,借书编号,借书数量,书名,所借人的帐号名 { int book_id; int borrowed_book_id; int count; char book_name[50]; char student_id[50]; struct have_been_borrowed *next; } BORROW, *Pborrow; typedef struct users //用户信息:用户id,帐户名,密码,所借书的上限 { long long int user_id; char user_name[50]; char passwd[50]; int book_limit; int job; struct users *next; } USERS, *Pusers; Pusers user_now = NULL; /**************************如下为函数声明**********************************/ void user_error(); //无用户信息的错误提示 int read_books_information_to_file(Pbook head, Pborrow head2, Pusers head3); //文件的读取 void welcome(); //欢迎界面 void null_error(); //图书库为空的报错信息 void list_borrow(Pborrow head); //打印已借图书信息 void addbook(struct books *head); //添加书籍信息 void list(Pbook head); //打印全部书籍信息 int search(Pbook head); //搜寻书籍信息 int modify(Pbook p); //搜寻结束后可进行查找 int del(Pbook before, Pbook will_be_del); //删除该图书信息 int borrow(Pbook head, Pborrow borrowed); //借书功能 void return_book_list(Pborrow head, Pbook origin); //还书的列表(便于控制函数的调用) int return_book(Pborrow head_list, Pbook origin); //还书功能 int return_book_by_student_id(Pborrow head, Pbook origin); //经过学号还书 void add_borrow(Pbook d, Pborrow head, int a, int b, int c, char name[], char book_name[]); //已借的书的添加 void borrowor(Pbook head, Pborrow borrowed); //借书菜单 void del_user(Pusers head); //删除用户 int add_users(Pusers head); //增长用户 void user_list(Pusers head); //打印全部用户信息 int user_manage(Pusers head); //用户管理主列表 int save_books_information_to_file(Pbook head, Pborrow head2, Pusers head3); //文件的保存 /**************************以上为函数声明**********************************/ /***************************图书基础功能***********************************/ int read_books_information_to_file(Pbook head, Pborrow head2, Pusers head3) { FILE *p = fopen("books_information.dat", "r"), *q = fopen("borrowed_books.dat", "r"); FILE *u = fopen("users_information.dat", "r"); if (p == NULL || q == NULL || u == NULL) { cout << "文件不存在。。。" << endl << "已重建相关文件" << endl; system("pause"); system("cls"); return 1; } Pbook books_head = head; Pborrow borrowed_head = head2; Pusers users_head = head3; int a, b, k; char name[50]; char author[50]; double price; while (fscanf(p, "%d%s%s%d%lf%d", &a, name, author, &k, &price, &b) != EOF) { Pbook before = (Pbook)malloc(sizeof(BOOK)); before->book_id = a; strcpy(before->book_name, name); strcpy(before->author, author); before->count = b; before->time = k; before->price = price; books_head->next = before; before->next = NULL; books_head = before; } int c, d, e; char borrow_name[50]; char student_id[50]; while (fscanf(q, "%d%s%d%d%s", &c, borrow_name, &d, &e, &student_id) != EOF) { Pborrow after = (Pborrow)malloc(sizeof(BORROW)); after->book_id = c; strcpy(after->book_name, borrow_name); after->borrowed_book_id = d; after->count = e; strcpy(after->student_id, student_id); borrowed_head->next = after; after->next = NULL; borrowed_head = after; } long long user_id; char user_name[50]; char passwd[50]; int book_limit; int job; while (fscanf(u, "%lld%s%s%d%d", &user_id, user_name, passwd, &book_limit,&job) != EOF) { Pusers english = (Pusers)malloc(sizeof(USERS)); english->user_id = user_id; strcpy(english->user_name, user_name); strcpy(english->passwd, passwd); english->book_limit = book_limit; english->job=job; users_head->next = english; english->next = NULL; users_head = english; } fclose(p); fclose(q); fclose(u); return 0; } int save_books_information_to_file(Pbook head, Pborrow head2, Pusers head3) { system("cls"); FILE *p = fopen("books_information.dat", "w"); FILE *bore = fopen("borrowed_books.dat", "w"); FILE *u = fopen("users_information.dat", "w"); if (p == NULL ) { cout << "打开文件失败!!!,请重试。。。" << endl; return 1; } if ( bore == NULL) { cout << "打开文件失败!!!,请重试。。。" << endl; return 1; } if ( u == NULL) { cout << "打开文件失败!!!,请重试。。。" << endl; return 1; } Pbook q = head->next; Pborrow w = head2->next; Pusers eng = head3->next; cout << "正在写入文件,请稍后。。。" << endl; Sleep(1500); while (q != NULL) { fprintf(p, "%d %s %s %d %f %d\n", q->book_id, q->book_name, q->author, q->time, q->price, q->count); q = q->next; } while (w != NULL) { fprintf(bore, "%d %s %d %d %s\n", w->book_id, w->book_name, w->borrowed_book_id, w->count, w->student_id); w = w->next; } while (eng != NULL) { fprintf(u, "%lld %s %s %d %d\n", eng->user_id, eng->user_name, eng->passwd, eng->book_limit,eng->job); eng = eng->next; } system("cls"); cout << "写入完成。请稍后。。。" << endl; fclose(p); fclose(bore); fclose(u); return 0; } void list_borrow(Pborrow head) { if (head->next == NULL) { system("cls"); cout << "数据库无借阅信息" << endl; cout << "请按回车退出 。。。" << endl; getchar(); getchar(); return; } system("cls"); for (int i = 0; i < 56; i++) printf("*"); printf("\n"); printf("* %11s", "借阅编号"); printf("%11s", "图书编号"); printf("%10s", "借阅数量"); printf("%18s *\n", "借阅者帐号"); Pborrow p = head->next; while (p != NULL) { printf("* %11d", p->borrowed_book_id); printf("%11d", p->book_id); printf("%10d", p->count); printf("%18s *\n", p->student_id); p = p->next; } for (int i = 0; i < 56; i++) printf("*"); cout << endl << "输入回车继续。。。" << endl; getchar(); getchar(); system("cls"); } void addbook(struct books *head) { int id, time, count; char name[50], author[50]; double price; struct books *q = head; while (1) { system("cls"); cout << "请输入书籍编号" << endl; cin >> id; cout << "请输入书籍名称" << endl; scanf("%s", name); cout << "请输入做者名字" << endl; scanf("%s", author); cout << "请输入出版时间" << endl; cin >> time; cout << "请输入书籍价格" << endl; cin >> price; cout << "请输入书籍数量" << endl; cin >> count; while (q->next != NULL) { if (id == q->next->book_id && strcmp(name, q->next->book_name) == 0 && strcmp(author, q->next->author) == 0) { if (time == q->next->time && price == q->next->price) { q->next->count += count; system("cls"); cout << "图书添加成功。。。" << endl; Sleep(1000); system("cls"); break; } } q = q->next; } if (q->next == NULL) { struct books *p; p = (struct books *)malloc(sizeof(struct books)); q->next = p; p->next = NULL; p->book_id = id; p->count = count; p->price = price; p->time = time; strcpy(p->book_name, name); strcpy(p->author, author); cout << "图书添加成功。。。" << endl; Sleep(1000); } system("cls"); int in; cout << "是否要继续?" << endl << "*****************" << endl << "* 1.继续 *" << endl << "* 0.结束 *" << endl << "*****************" << endl; cin >> in; if (in == 0) return; } } void null_error() { system("cls"); cout << "数据库无图书信息,请先添加图书信息" << endl; cout << "请按回车退出搜索。。。" << endl; system("pause"); } void list(Pbook head) { if (head->next == NULL) { null_error(); return; } system("cls"); for (int i = 0; i < 70; i++) printf("*"); printf("\n"); printf("* %8s", "图书编号"); printf("%14s", "图书名称"); printf("%10s", "做者"); printf("%14s", "时间"); printf("%10s", "价格"); printf("%10s *\n", "数量"); Pbook p = head->next; while (p != NULL) { printf("* %8d", p->book_id); printf("%14s", p->book_name); printf("%10s", p->author); printf("%14d", p->time); printf("%10.2f", p->price); printf("%10d *\n", p->count); p = p->next; } for (int i = 0; i < 70; i++) printf("*"); cout << endl << "输入回车继续。。。" << endl; system("pause"); system("cls"); } /*************************图书查找,修改,删除功能区*******************************/ int search(Pbook head) { int want_to_search, flag; while (1) { Pbook p = head->next, before = head; flag = 0; if (head->next == NULL) { null_error(); return 0; } system("cls"); cout << "请输入要搜索的图书编号:"; cin >> want_to_search; system("cls"); cout << "正在寻找,请稍后。。。"; while (p != NULL) { if (p->book_id == want_to_search) { system("cls"); flag = 1; break; } before = p; p = p->next; } if (flag == 0) { system("cls"); cout << "未查找到相应图书信息\n"; cout << "接下来要作什么?" << endl << "\t1.继续查找" << endl << "\t0.结束" << endl; int in; cin >> in; if (in == 1) continue; else return 0; } else { int in; system("cls"); cout << "已找到相关图书,接下来要作什么?" << endl; while (1) { int flag1 = 0; cout << "******************************" << endl; cout << "* 1.打印相关图书信息 *" << endl; cout << "* 2.对相关图书进行修改 *" << endl; cout << "* 3.删除该图书信息 *" << endl; cout << "* 4.继续查找 *" << endl; cout << "* 0.退出 *" << endl; cout << "******************************" << endl; cin >> in; switch (in) { case 1: system("cls"); for (int i = 0; i < 70; i++) printf("*"); printf("\n* %8s", "图书编号"); printf("%14s", "图书名称"); printf("%10s", "做者"); printf("%14s", "时间"); printf("%10s", "价格"); printf("%10s *\n", "数量"); printf("* %8d", p->book_id); printf("%14s", p->book_name); printf("%10s", p->author); printf("%14d", p->time); printf("%10.2f", p->price); printf("%10d *\n", p->count); for (int i = 0; i < 70; i++) printf("*"); cout << endl << "输入以回车继续。。。"; getchar(); getchar(); system("cls"); flag = 0; break; case 2: if (modify(p) == 1) { flag1 = 1; break; } else { flag1 = 0; break; } case 3: if (del(before, p) == 1) { return 1; } else { return 0; } case 4: flag1 = 1; break; case 0: return 0; } if (flag1 == 1) break; else { system("cls"); cout << "还须要作什么?" << endl; continue; } } } } } int del(Pbook before, Pbook will_be_del) { before->next = will_be_del->next; free(will_be_del); system("cls"); cout << "该图书信息已被删除" << endl << "你还须要作什么?" << endl; while (1) { cout << "**********************" << endl << "* 1.继续搜索 *" << endl << "* 0.退出搜索 *" << endl << "**********************" << endl; int in; cin >> in; if (in == 1) { return 1; } else if (in == 0) return 0; else { cout << "输入错误,请从新选择" << endl; continue; } } } int modify(Pbook p) { system("cls"); cout << "您须要作什么?" << endl; int in; while (1) { cout << "*************************" << endl; cout << "* 1.修改图书名称 *" << endl; cout << "* 2.修改做者 *" << endl; cout << "* 3.修改出版时间 *" << endl; cout << "* 4.修改价格 *" << endl; cout << "* 5.修改数量 *" << endl; cout << "* 6.回到上一目录 *" << endl; cout << "* 0.退出 *" << endl; cout << "*************************" << endl; cin >> in; system("cls"); switch (in) { case 1: cout << "原有的图书名称为:" << p->book_name << endl << "请键入修改后的名称:"; scanf("%s", p->book_name); break; case 2: cout << "原有的做者为:" << p->author << endl << "请键入修改后的做者:"; scanf("%s", p->author); break; case 3: cout << "原有的出版时间为:" << p->time << endl; cout << "请键入修改后的时间:"; cin >> p->time; break; case 4: cout << "原有的价格为:" << p->price << endl; cout << "请键入修改后的价格:"; cin >> p->price; break; case 5: cout << "原有的数量为:" << p->count << endl; cout << "请键入修改后的数量:"; cin >> p->count; break; case 6: return 0; break; case 0: return 1; break; } system("cls"); cout << "信息修改为功,按回车继续。。。" << endl; system("pause"); system("cls"); cout << "您还须要作什么?" << endl; } } /************************************借阅功能区**************************************************/ void borrowor(Pbook head, Pborrow borrowed) { system("cls"); if (head->next == NULL) { null_error(); return; } int in; cout << "您要作什么" << endl; while (1) { cout << "***************************" << endl << "* 1.借阅图书 *" << endl << "* 2.归还图书 *" << endl << "* 0.退出 *" << endl << "***************************" << endl; cin >> in; int tsl; switch (in) { case 1: tsl = borrow(head, borrowed); while (tsl != 0) { tsl = borrow(head, borrowed); } break; case 2: return_book_list(borrowed, head); break; case 0: return; } system("cls"); cout << "您还须要作什么?" << endl; } } int borrow(Pbook head, Pborrow borrowed) { system("cls"); cout << "请输入搜寻根据" << endl; cout << "*************************" << endl << "* 1.图书编号 *" << endl << "* 2.图书名称 *" << endl << "* 3.图书做者 *" << endl << "* 0.退出 *" << endl << "*************************" << endl; int in; cin >> in; system("cls"); int want_to_find_num; char want_to_find_name[50]; char want_to_find_author[50]; switch (in) { case 1: cout << "请输入图书编号:"; cin >> want_to_find_num; break; case 2: cout << "请输入图书名称:"; cin >> want_to_find_name; break; case 3: cout << "请输入图书做者:"; cin >> want_to_find_author; break; case 0: return 0; } Pbook p = head->next; int flag2 = 0; while (p != NULL) { switch (in) { case 1: if (want_to_find_num == p->book_id) flag2 = 1; break; case 2: if (strcmp(want_to_find_name, p->book_name) == 0) flag2 = 1; break; case 3: if (strcmp(want_to_find_author, p->author) == 0) flag2 = 1; break; } if (flag2 == 1) break; p = p->next; } if (flag2 == 0) { system("cls"); cout << "未找到相关图书,是否借阅其它图书?" << endl; cout << "********************" << endl << "* 1.继续 *" << endl << "* 0.结束 *" << endl << "********************" << endl; int intwice; cin >> intwice; if (intwice == 1) return 1; else return 0; } else { system("cls"); if (p->count == 0) { cout << "该图书暂时缺货" << endl << "****************" << endl << "* 1.继续借阅 *" << endl << "* 0.退出 *" << endl << "****************" << endl; int in; cin >> in; if (in == 1) return 1; else return 0; } cout << "已找到该图书,"; while (1) { cout << "目前此书还有" << p->count << "本" << endl << "你如今还能够借阅" << user_now->book_limit << "本书" << endl << "请输入借阅数量(输入0为取消借阅):" << endl; int borrow_count; cin >> borrow_count; system("cls"); if (borrow_count > p->count) { cout << "没这么多书!!!" << endl << "************************" << endl << "* 1.输入其余数量 *" << endl << "* 2.借阅其余图书 *" << endl << "* 0.取消借阅 *" << endl << "************************" << endl; int choose_book; cin >> choose_book; if (choose_book == 2) return 1; else if (choose_book == 0) return 0; else { system("cls"); continue; } } else { p->count -= borrow_count; user_now->book_limit -= borrow_count; add_borrow(p, borrowed, p->book_id, p->book_id * 10000 + p->count, borrow_count, user_now->user_name, p->book_name); cout << "借阅成功,请按时归还。" << endl << "输入回车以继续。。。"; getchar(); return 0; } system("cls"); } } return 0; } void add_borrow(Pbook d, Pborrow head, int a, int b, int c, char name[], char book_name[]) { Pborrow p = head; while (p->next != NULL) p = p->next; Pborrow q = (Pborrow)malloc(sizeof(BORROW)); q->book_id = a; strcpy(q->book_name, book_name); q->borrowed_book_id = b; q->count = c; strcpy(q->student_id, name); p->next = q; q->next = NULL; cout << "请记录您的借书编号:" << b << endl; cout << "请按下回车继续。。。"; getchar(); getchar(); system("cls"); return; } void return_book_list(Pborrow head, Pbook origin) { system("cls"); cout << "请选择:" << endl << "**************************" << endl << "* 1.经过学号还书 *" << endl << "* 2.经过编号还书 *" << endl << "* 0.退出 *" << endl << "**************************" << endl; int in; cin >> in; system("cls"); if (in == 1) { return_book_by_student_id(head, origin); } else if (in == 2) { return_book(head, origin); } else return; } int return_book_by_student_id(Pborrow head, Pbook origin) { system("cls"); char student_id[50]; int flag = 0; cout << "请输入您的账号:"; cin >> student_id; system("cls"); Pborrow p = head->next; while (p != NULL) { if (strcmp(p->student_id, student_id) == 0) { if (flag == 0) { flag = 1; cout << "****************************************************************" << endl << "* 借书编号 书籍名称 借书数量 借书者学号 *" << endl; } printf("*%10d", p->borrowed_book_id); printf("%14s", p->book_name); printf("%14d", p->count); printf("%18s *\n", p->student_id); } p = p->next; } if (flag == 1) { cout << "****************************************************************" << endl; return_book(head, origin); return 0; } else { system("cls"); cout << "您没有借过书" << endl << "按下回车继续。。。" << endl; getchar(); getchar(); system("cls"); return 0; } } int return_book(Pborrow head_list, Pbook origin) { int return_id; cout << "请输入您的借书编号以还书(输入0取消还书):"; cin >> return_id; if (return_id == 0) { system("cls"); cout << "取消成功" << endl; system("pause"); return 0; } int flag = 0; Pborrow p = head_list->next, before = head_list; while (p != NULL) { if (p->borrowed_book_id == return_id) { flag = 1; break; } before = p; p = p->next; } system("cls"); if (flag == 0) { cout << "借书编号有误,请从新输入" << endl; cout << "按下回车继续"; getchar(); getchar(); system("cls"); return 1; } else { origin->count += p->count; user_now->book_limit += p->count; before->next = p->next; free(p); cout << "归还成功。。。"; Sleep(2000); system("cls"); } return 0; } int fix_passwd_by_oneself() { system("cls"); while (1) { cout << "请输入修改后的密码:"; char passwd_now[50], again[50]; cin >> passwd_now; cout << "请再次输入密码:"; cin >> again; if (strcmp(passwd_now, again) == 0) { strcpy(user_now->passwd, passwd_now); cout << "密码修改为功。。。" << endl; system("pause"); return 0; } else { cout << "两次输入密码不一致。。。" << endl; system("pause"); } } } /*****************************************用户管理***********************************************/ char administrator[50] = "admin"; char admin_passwd[50] = "admin"; int user_judge(Pusers head) { system("cls"); char user_id[50]; cout << "请输入您的帐号:"; cin >> user_id; if (strcmp(administrator, user_id) == 0) { cout << "请输入密码:"; char passwd[50]; cin >> passwd; if (strcmp(passwd, admin_passwd) == 0) return 2; //权限为2,即最高权限————管理员 } Pusers p = head->next; while (p != NULL) { if (strcmp(p->user_name, user_id) == 0) { char passwd[50]; cout << "请输入密码:"; cin >> passwd; int count_limit = 3; while (count_limit--) { if (strcmp(passwd, p->passwd) == 0) { user_now = p; return 1; } //权限为1,为用户权限 } return 0; //权限为0,即未登陆,没有权限 } p = p->next; } cout << "暂未收录该用户信息,请联系管理员。。。" << endl; system("pause"); return 0; } void user_error() { system("cls"); cout << "暂未收录任何用户信息" << endl; system("pause"); } void del_user(Pusers head) { if (head->next == NULL) { user_error(); return; } cout << "请输入要注销用户编号:"; long long id; cin >> id; Pusers p = head; while (p->next != NULL) { if (id == p->user_id) { break; } p = p->next; } if (p->next == NULL) { cout << "该用户不存在。。。" << endl; system("pause"); return; } p->next = p->next->next; free(p->next); cout << "用户删除成功。。。" << endl; system("pause"); return; } int add_users(Pusers head) { system("cls"); Pusers p = head; while (p->next != NULL) { p = p->next; } while (1) { system("cls"); Pusers q = (Pusers)malloc(sizeof(USERS)); p->next = q; q->next = NULL; char idid[50]; int flag = 1; while (flag) { cout << "请输入用户编号(编号为数字):"; cin >> idid; q->user_id=0; long long ten=1; for (int i = strlen(idid)-1; i >=0 ; i--) { if (idid[i] >= '0' && idid[i] <= '9') { q->user_id +=( idid[i] - '0')*ten; flag = 0; ten*=10; } else { flag = 1; break; } } if (flag == 1) { system("cls"); cout << "编号为数字!!!" << endl; cout << "编号为数字!!!" << endl; cout << "编号为数字!!!" << endl; system("pause"); system("cls"); } } flag = 1; while (flag) { cout << "请输入帐号:"; scanf("%s", q->user_name); if (strcmp(q->user_name, "admin") == 0) { cout << "帐号不能为admin" << endl; system("pause") } Pusers chongfu = head->next; while (chongfu != NULL) { if (strcmp(q->user_name, chongfu->user_name) == 0) { break; } } if (chongfu == NULL) { flag = 0; } else { cout << "用户名已存在" << endl; system("pause"); system("cls"); } } cout << "请输入密码:"; scanf("%s", q->passwd); cout << "用户身份:" << endl << "1.学生" << endl << "2.老师" << endl; int job; cin >> job; q->book_limit = job * 10; q->job=job; p->next = q; p = p->next; system("cls"); cout << "添加成功。。。" << endl; system("pause"); system("cls"); cout << "是否继续添加?" << endl << "1.是" << endl << "0.否" << endl; cin >> job; system("cls"); if (job == 0) { return 0; } } } void user_list(Pusers head) { system("cls"); if (head->next == NULL) { user_error(); return; } Pusers p = head->next; printf("%10s%16s%16s\n", "用户编号", "用户名", "身份"); while (p != NULL) { char job[50]; if (p->job == 1) { strcpy(job, "学生"); } else strcpy(job, "老师"); printf("%10d", p->user_id); printf("%16s", p->user_name); printf("%16s\n", job); p = p->next; } system("pause"); system("cls"); } int user_manage(Pusers head) { system("cls"); cout << "1.增长用户" << endl << "2.注销用户" << endl << "3.全部用户" << endl << "0.退出" << endl; cout << "请选择:"; int in; cin >> in; switch (in) { case 1: add_users(head); break; case 2: del_user(head); break; case 3: user_list(head); break; case 0: return 0; } } /*****************************************主函数区***********************************************/ void welcome(int root) { if (root == 1) { cout << "1.全部图书" << endl << "2.借还图书" << endl << "3.更改密码" << endl << "0.退出" << endl; } else if (root == 2) { cout << "1.增长图书" << endl << "2.全部图书" << endl << "3.搜索图书" << endl << "4.用户管理" << endl << "5.查看全部已借图书" << endl << "0.退出" << endl; } printf("请输入相应序号:"); } int main() { int n; BOOK headd; BORROW borrowedd; Pbook head = &headd; Pborrow borrowed = &borrowedd; USERS user_head; Pusers puser = &user_head; headd.next = NULL; borrowedd.next = NULL; user_head.next = NULL; read_books_information_to_file(head, borrowed, puser); int root = user_judge(puser); system("cls"); while (root == 0) { cout << "\t1.继续登录" << endl << "\t0.退出" << endl; cout << "\t请选择:"; int in; cin >> in; if (in == 0) { cout << "感谢使用。。。" << endl; Sleep(1000); return 0; } else { root = user_judge(puser); } } welcome(root); int ffllaagg; if (root == 1) //普通用户选项 { while (cin >> n) { if (n == 0) { system("cls"); // cout << "感谢您的使用." << endl; break; ; } switch (n) { case 1: list(head); break; case 2: borrowor(head, borrowed); break; case 3: fix_passwd_by_oneself(); break; } system("cls"); cout << "你还要作什么:" << endl; welcome(root); } } else if (root == 2) { while (cin >> n) { if (n == 0) { system("cls"); // cout << "感谢您的使用." << endl; break; ; } switch (n) { case 1: addbook(head); break; case 2: list(head); break; case 3: ffllaagg = search(head); while (ffllaagg) { ffllaagg = search(head); } break; case 4: user_manage(puser); break; case 5: list_borrow(borrowed); break; } system("cls"); cout << "您还须要作什么" << endl; welcome(root); } } system("cls"); save_books_information_to_file(head, borrowed, puser); system("pause"); return 0; }