|
|
|
|
#include <cstdio>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <conio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
#include "information.h"
|
|
|
|
|
|
|
|
|
|
int v;
|
|
|
|
|
int g;
|
|
|
|
|
struct BOOK b;
|
|
|
|
|
struct BOOK *i;
|
|
|
|
|
struct BOOK *j;
|
|
|
|
|
struct BOOK *H;
|
|
|
|
|
struct BOOK *T;
|
|
|
|
|
struct BOOK *Head;
|
|
|
|
|
struct BOOK *Temp;
|
|
|
|
|
extern int vip;
|
|
|
|
|
extern struct STUDENT *HEAD;
|
|
|
|
|
extern struct STUDENT *TEMP;
|
|
|
|
|
|
|
|
|
|
void cls();
|
|
|
|
|
void Login();
|
|
|
|
|
void stu_menu();
|
|
|
|
|
void adm_menu();
|
|
|
|
|
void read_user();
|
|
|
|
|
void adm_window();
|
|
|
|
|
void view1_book();
|
|
|
|
|
void view2_book();
|
|
|
|
|
void recovery_window();
|
|
|
|
|
void book_printf(int a);
|
|
|
|
|
void tp(short x, short y);
|
|
|
|
|
void color(short x);
|
|
|
|
|
|
|
|
|
|
void Swap(char *a, char *b) {
|
|
|
|
|
char t[21];
|
|
|
|
|
strcpy(t, a);
|
|
|
|
|
strcpy(a, b);
|
|
|
|
|
strcpy(b, t);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Swap_num(int *a, int *b) {
|
|
|
|
|
int t;
|
|
|
|
|
t = *a;
|
|
|
|
|
*a = *b;
|
|
|
|
|
*b = t;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void read_book() {
|
|
|
|
|
struct BOOK *p;
|
|
|
|
|
T = (struct BOOK *)malloc(sizeof(struct BOOK));
|
|
|
|
|
H = T;
|
|
|
|
|
FILE *fp = fopen("book.txt", "r");
|
|
|
|
|
if(fp == NULL) {
|
|
|
|
|
cls();
|
|
|
|
|
color(12);
|
|
|
|
|
tp(39, 8);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>");
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>...");
|
|
|
|
|
tp(39, 12);
|
|
|
|
|
getch();
|
|
|
|
|
exit(2);
|
|
|
|
|
}
|
|
|
|
|
while(!feof(fp)) {
|
|
|
|
|
p = T;
|
|
|
|
|
fscanf(fp, "%s %s %s %s %d\n", T->name, T->author, T->type, T->publish, &T->number);
|
|
|
|
|
T->next = (struct BOOK *)malloc(sizeof(struct BOOK));
|
|
|
|
|
T = T->next;
|
|
|
|
|
}
|
|
|
|
|
free(T);
|
|
|
|
|
p->next = NULL;
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void read_lend() {
|
|
|
|
|
struct BOOK *p;
|
|
|
|
|
Temp = (struct BOOK *)malloc(sizeof(struct BOOK));
|
|
|
|
|
Head = Temp;
|
|
|
|
|
FILE *fp = fopen("lend.txt", "r");
|
|
|
|
|
if(fp == NULL) {
|
|
|
|
|
cls();
|
|
|
|
|
color(12);
|
|
|
|
|
tp(39, 8);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>");
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>...");
|
|
|
|
|
tp(39, 12);
|
|
|
|
|
getch();
|
|
|
|
|
exit(2);
|
|
|
|
|
}
|
|
|
|
|
while(!feof(fp)) {
|
|
|
|
|
p = Temp;
|
|
|
|
|
fscanf(fp, "%s %s %s %s %s\n", Temp->name, Temp->author, Temp->type, Temp->publish, Temp->user);
|
|
|
|
|
Temp->next = (struct BOOK *)malloc(sizeof(struct BOOK));
|
|
|
|
|
Temp = Temp->next;
|
|
|
|
|
}
|
|
|
|
|
free(Temp);
|
|
|
|
|
p->next = NULL;
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int user_num(int z, int h) {
|
|
|
|
|
int d = 0, n = 0;
|
|
|
|
|
char t, u[10];
|
|
|
|
|
t = getch();
|
|
|
|
|
while(1) {
|
|
|
|
|
if(t == 13) {
|
|
|
|
|
if(n == 0) {
|
|
|
|
|
tp(65, 6);
|
|
|
|
|
printf(" ");
|
|
|
|
|
tp(65, 6);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>");
|
|
|
|
|
tp(45 + h, z);
|
|
|
|
|
t = getch();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if(t == 27)
|
|
|
|
|
adm_menu();
|
|
|
|
|
if(t == 8 && n == 0) {
|
|
|
|
|
t = getch();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else if(t == 8) {
|
|
|
|
|
tp(65, 6);
|
|
|
|
|
printf(" ");
|
|
|
|
|
tp(45 + h, z);
|
|
|
|
|
printf(" ");
|
|
|
|
|
tp(45 + h, z);
|
|
|
|
|
n--;
|
|
|
|
|
u[n] = 0;
|
|
|
|
|
printf("%s", u);
|
|
|
|
|
t = getch();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if(n == 10) {
|
|
|
|
|
tp(65, 6);
|
|
|
|
|
printf(" ");
|
|
|
|
|
tp(65, 6);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
tp(45 + h, z);
|
|
|
|
|
t = getch();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if(t > 47 && t < 58) {
|
|
|
|
|
tp(65, 6);
|
|
|
|
|
printf(" ");
|
|
|
|
|
tp(45 + h, z);
|
|
|
|
|
u[n] = t;
|
|
|
|
|
n++;
|
|
|
|
|
u[n] = 0;
|
|
|
|
|
printf("%s", u);
|
|
|
|
|
t = getch();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
tp(65, 6);
|
|
|
|
|
printf(" ");
|
|
|
|
|
tp(65, 6);
|
|
|
|
|
printf("<EFBFBD>벻Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
tp(45 + h, z);
|
|
|
|
|
t = getch();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for(int i = n - 1, j = 1; i >= 0; i--, j *= 10)
|
|
|
|
|
d += (u[i] - 48)*j;
|
|
|
|
|
return d;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void user_name(int z, char *u, int h) {
|
|
|
|
|
int n = 0;
|
|
|
|
|
char t;
|
|
|
|
|
t = getch();
|
|
|
|
|
while(1) {
|
|
|
|
|
if(t == 13) {
|
|
|
|
|
if(v == 1 && n < 6) {
|
|
|
|
|
tp(65, 6);
|
|
|
|
|
printf(" ");
|
|
|
|
|
tp(65, 6);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
tp(45 + h, z);
|
|
|
|
|
t = getch();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if(n == 0) {
|
|
|
|
|
tp(65, 6);
|
|
|
|
|
printf(" ");
|
|
|
|
|
tp(65, 6);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>");
|
|
|
|
|
tp(45 + h, z);
|
|
|
|
|
t = getch();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if(t == 27) {
|
|
|
|
|
if(vip == 1) {
|
|
|
|
|
if(g == 1)
|
|
|
|
|
view2_book();
|
|
|
|
|
else
|
|
|
|
|
adm_menu();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if(g == 1)
|
|
|
|
|
view1_book();
|
|
|
|
|
else
|
|
|
|
|
stu_menu();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(t == 8 && n == 0) {
|
|
|
|
|
t = getch();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else if(t == 8) {
|
|
|
|
|
tp(65, 6);
|
|
|
|
|
printf(" ");
|
|
|
|
|
tp(45 + h, z);
|
|
|
|
|
printf(" ");
|
|
|
|
|
tp(45 + h, z);
|
|
|
|
|
n--;
|
|
|
|
|
u[n] = 0;
|
|
|
|
|
if(u[n - 1] < 0) {
|
|
|
|
|
n--;
|
|
|
|
|
u[n] = 0;
|
|
|
|
|
}
|
|
|
|
|
printf("%s", u);
|
|
|
|
|
t = getch();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if(n == 20) {
|
|
|
|
|
tp(65, 6);
|
|
|
|
|
printf(" ");
|
|
|
|
|
tp(65, 6);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
tp(45 + h, z);
|
|
|
|
|
t = getch();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if(t == 32) {
|
|
|
|
|
tp(65, 6);
|
|
|
|
|
printf(" ");
|
|
|
|
|
tp(65, 6);
|
|
|
|
|
printf("<EFBFBD>벻Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ո<EFBFBD>");
|
|
|
|
|
tp(45 + h, z);
|
|
|
|
|
t = getch();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if(t == 0 || t == -32) {
|
|
|
|
|
getch();
|
|
|
|
|
t = getch();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if(t < 0) {
|
|
|
|
|
tp(65, 6);
|
|
|
|
|
printf(" ");
|
|
|
|
|
tp(45 + h, z);
|
|
|
|
|
u[n] = t;
|
|
|
|
|
n++;
|
|
|
|
|
t = getch();
|
|
|
|
|
u[n] = t;
|
|
|
|
|
n++;
|
|
|
|
|
u[n] = 0;
|
|
|
|
|
printf("%s", u);
|
|
|
|
|
t = getch();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
tp(65, 6);
|
|
|
|
|
printf(" ");
|
|
|
|
|
tp(45 + h, z);
|
|
|
|
|
u[n] = t;
|
|
|
|
|
n++;
|
|
|
|
|
u[n] = 0;
|
|
|
|
|
printf("%s", u);
|
|
|
|
|
t = getch();
|
|
|
|
|
}
|
|
|
|
|
u[n] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int search_book() {
|
|
|
|
|
cls();
|
|
|
|
|
int x = 0;
|
|
|
|
|
struct BOOK temp;
|
|
|
|
|
color(12);
|
|
|
|
|
tp(39, 8);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
tp(39, 12);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
tp(39, 14);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
color(8);
|
|
|
|
|
tp(39, 16);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ESC<EFBFBD><EFBFBD><EFBFBD>ز˵<EFBFBD>");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(44, 10);
|
|
|
|
|
user_name(10, temp.name, -1);
|
|
|
|
|
tp(44, 12);
|
|
|
|
|
user_name(12, temp.author, -1);
|
|
|
|
|
tp(46, 14);
|
|
|
|
|
user_name(14, temp.publish, 1);
|
|
|
|
|
tp(39, 18);
|
|
|
|
|
read_book();
|
|
|
|
|
T = H;
|
|
|
|
|
while(T != NULL) {
|
|
|
|
|
if(!strcmp(temp.name, T->name) && !strcmp(temp.author, T->author) && !strcmp(temp.publish, T->publish)) {
|
|
|
|
|
x = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
T = T->next;
|
|
|
|
|
}
|
|
|
|
|
return x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void no_info() {
|
|
|
|
|
color(12);
|
|
|
|
|
printf("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 20);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
tp(39, 22);
|
|
|
|
|
getch();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void inquire1() {
|
|
|
|
|
if(search_book()) {
|
|
|
|
|
cls();
|
|
|
|
|
tp(39, 8);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->name);
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->author);
|
|
|
|
|
tp(39, 12);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->type);
|
|
|
|
|
tp(39, 14);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->publish);
|
|
|
|
|
tp(39, 16);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%d\n", T->number);
|
|
|
|
|
tp(39, 18);
|
|
|
|
|
printf("| 1.ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |");
|
|
|
|
|
tp(39, 20);
|
|
|
|
|
printf("| 2.ͼ<><CDBC><EFBFBD>黹 |");
|
|
|
|
|
tp(39, 22);
|
|
|
|
|
printf("| <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز˵<D8B2> |");
|
|
|
|
|
switch(getch()) {
|
|
|
|
|
case '1':book_printf(-1);break;
|
|
|
|
|
case '2':book_printf(1);
|
|
|
|
|
default :break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
no_info();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void inquire2() {
|
|
|
|
|
if(search_book()) {
|
|
|
|
|
cls();
|
|
|
|
|
tp(39, 8);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->name);
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->author);
|
|
|
|
|
tp(39, 12);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->type);
|
|
|
|
|
tp(39, 14);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->publish);
|
|
|
|
|
tp(39, 16);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%d\n", T->number);
|
|
|
|
|
tp(39, 18);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز˵<EFBFBD>...");
|
|
|
|
|
getch();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
no_info();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void change_question() {
|
|
|
|
|
cls();
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 8);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->name);
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->author);
|
|
|
|
|
tp(39, 12);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->type);
|
|
|
|
|
tp(39, 14);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->publish);
|
|
|
|
|
tp(39, 16);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%d", T->number);
|
|
|
|
|
color(12);
|
|
|
|
|
tp(39, 18);
|
|
|
|
|
printf("<EFBFBD>Ƿ<EFBFBD><EFBFBD>ĸ<EFBFBD>ͼ<EFBFBD><EFBFBD>");
|
|
|
|
|
tp(39, 20);
|
|
|
|
|
printf("| 1.<2E><> |");
|
|
|
|
|
tp(39, 22);
|
|
|
|
|
printf("| 2.<2E><> |");
|
|
|
|
|
tp(39, 24);
|
|
|
|
|
switch(getch()) {
|
|
|
|
|
case '1':break;
|
|
|
|
|
case '2':adm_menu();
|
|
|
|
|
case '\e':adm_menu();
|
|
|
|
|
default :change_question();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void change_book() {
|
|
|
|
|
cls();
|
|
|
|
|
int x = 0;
|
|
|
|
|
struct BOOK t;
|
|
|
|
|
color(12);
|
|
|
|
|
tp(39, 8);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ĵ<EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
tp(39, 12);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
tp(39, 14);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
color(8);
|
|
|
|
|
tp(39, 16);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ESC<EFBFBD><EFBFBD><EFBFBD>ز˵<EFBFBD>");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(44, 10);
|
|
|
|
|
user_name(10, t.name, -1);
|
|
|
|
|
tp(44, 12);
|
|
|
|
|
user_name(12, t.author, -1);
|
|
|
|
|
tp(46, 14);
|
|
|
|
|
user_name(14, t.publish, 1);
|
|
|
|
|
tp(39, 18);
|
|
|
|
|
read_book();
|
|
|
|
|
T = H;
|
|
|
|
|
while(T != NULL) {
|
|
|
|
|
if(!strcmp(t.name, T->name) && !strcmp(t.author, T->author) && !strcmp(t.publish, T->publish)) {
|
|
|
|
|
x = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
T = T->next;
|
|
|
|
|
}
|
|
|
|
|
if(x) {
|
|
|
|
|
change_question();
|
|
|
|
|
cls();
|
|
|
|
|
color(11);
|
|
|
|
|
tp(30, 8);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->name);
|
|
|
|
|
tp(54, 8);
|
|
|
|
|
printf("->");
|
|
|
|
|
tp(30, 10);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->author);
|
|
|
|
|
tp(54, 10);
|
|
|
|
|
printf("->");
|
|
|
|
|
tp(30, 12);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->type);
|
|
|
|
|
tp(54, 12);
|
|
|
|
|
printf("->");
|
|
|
|
|
tp(30, 14);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->publish);
|
|
|
|
|
tp(54, 14);
|
|
|
|
|
printf("->");
|
|
|
|
|
tp(30, 16);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%d", T->number);
|
|
|
|
|
tp(54, 16);
|
|
|
|
|
printf("->");
|
|
|
|
|
color(8);
|
|
|
|
|
tp(39, 18);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ESC<EFBFBD><EFBFBD><EFBFBD>ز˵<EFBFBD>");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(64, 8);
|
|
|
|
|
user_name(8, T->name, 19);
|
|
|
|
|
tp(64, 10);
|
|
|
|
|
user_name(10, T->author, 19);
|
|
|
|
|
tp(64, 12);
|
|
|
|
|
user_name(12, T->type, 19);
|
|
|
|
|
tp(64, 14);
|
|
|
|
|
user_name(14, T->publish, 19);
|
|
|
|
|
tp(64, 16);
|
|
|
|
|
T->number = user_num(16, 19);
|
|
|
|
|
tp(39, 20);
|
|
|
|
|
for(i = H; i != NULL; i = i->next)
|
|
|
|
|
for(j = i->next; j != NULL; j = j->next)
|
|
|
|
|
if(i->number > j->number) {
|
|
|
|
|
Swap(i->name, j->name);
|
|
|
|
|
Swap(i->author, j->author);
|
|
|
|
|
Swap(i->type, j->type);
|
|
|
|
|
Swap(i->publish, j->publish);
|
|
|
|
|
Swap_num(&i->number, &j->number);
|
|
|
|
|
}
|
|
|
|
|
T = H;
|
|
|
|
|
FILE *fp = fopen("book.txt", "w");
|
|
|
|
|
while(T != NULL) {
|
|
|
|
|
fprintf(fp, "%s %s %s %s %d\n", T->name, T->author, T->type, T->publish, T->number);
|
|
|
|
|
T = T->next;
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
color(12);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>");
|
|
|
|
|
tp(39, 22);
|
|
|
|
|
color(11);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
tp(39, 22);
|
|
|
|
|
getch();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
no_info();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void add_() {
|
|
|
|
|
T = H;
|
|
|
|
|
while(T != NULL) {
|
|
|
|
|
if(b.number <= H->number) {
|
|
|
|
|
i = H;
|
|
|
|
|
H = &b;
|
|
|
|
|
b.next = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if(T->next == NULL) {
|
|
|
|
|
T->next = &b;
|
|
|
|
|
b.next = NULL;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if(b.number <= T->next->number) {
|
|
|
|
|
i = T->next;
|
|
|
|
|
T->next = &b;
|
|
|
|
|
b.next = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
T = T->next;
|
|
|
|
|
}
|
|
|
|
|
for(i = H; i != NULL; i = i->next)
|
|
|
|
|
for(j = i->next; j != NULL; j = j->next)
|
|
|
|
|
if(i->number > j->number) {
|
|
|
|
|
Swap(i->name, j->name);
|
|
|
|
|
Swap(i->author, j->author);
|
|
|
|
|
Swap(i->type, j->type);
|
|
|
|
|
Swap(i->publish, j->publish);
|
|
|
|
|
Swap_num(&i->number, &j->number);
|
|
|
|
|
}
|
|
|
|
|
T = H;
|
|
|
|
|
FILE *fp = fopen("book.txt", "w");
|
|
|
|
|
while(T != NULL) {
|
|
|
|
|
fprintf(fp, "%s %s %s %s %d\n", T->name, T->author, T->type, T->publish, T->number);
|
|
|
|
|
T = T->next;
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
cls();
|
|
|
|
|
color(12);
|
|
|
|
|
tp(39, 8);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ӳɹ<EFBFBD>");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
tp(39, 12);
|
|
|
|
|
getch();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void add_question() {
|
|
|
|
|
color(12);
|
|
|
|
|
tp(39, 22);
|
|
|
|
|
printf("<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӹ<EFBFBD>ͼ<EFBFBD><EFBFBD>");
|
|
|
|
|
tp(39, 24);
|
|
|
|
|
printf("| 1.<2E><> |");
|
|
|
|
|
tp(39, 26);
|
|
|
|
|
printf("| 2.<2E><> |");
|
|
|
|
|
tp(39, 28);
|
|
|
|
|
switch(getch()) {
|
|
|
|
|
case '1':add_();break;
|
|
|
|
|
case '2':break;
|
|
|
|
|
case '\e':adm_menu();
|
|
|
|
|
default :add_question();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void add_book() {
|
|
|
|
|
cls();
|
|
|
|
|
int x = 0;
|
|
|
|
|
color(12);
|
|
|
|
|
tp(39, 8);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
tp(39, 12);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
tp(39, 14);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
tp(39, 16);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
tp(39, 18);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
color(8);
|
|
|
|
|
tp(39, 20);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ESC<EFBFBD><EFBFBD><EFBFBD>ز˵<EFBFBD>");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(44, 10);
|
|
|
|
|
user_name(10, b.name, -1);
|
|
|
|
|
tp(44, 12);
|
|
|
|
|
user_name(12, b.author, -1);
|
|
|
|
|
tp(44, 14);
|
|
|
|
|
user_name(14, b.type, -1);
|
|
|
|
|
tp(46, 16);
|
|
|
|
|
user_name(16, b.publish, 1);
|
|
|
|
|
tp(44, 18);
|
|
|
|
|
b.number = user_num(18, -1);
|
|
|
|
|
tp(39, 22);
|
|
|
|
|
read_book();
|
|
|
|
|
T = H;
|
|
|
|
|
while(T != NULL) {
|
|
|
|
|
if(!strcmp(b.name, T->name) && !strcmp(b.author, T->author) && !strcmp(b.publish, T->publish)) {
|
|
|
|
|
x = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
T = T->next;
|
|
|
|
|
}
|
|
|
|
|
if(x) {
|
|
|
|
|
cls();
|
|
|
|
|
color(12);
|
|
|
|
|
tp(39, 8);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
tp(39, 12);
|
|
|
|
|
getch();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
add_question();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void del_() {
|
|
|
|
|
struct BOOK *p = H;
|
|
|
|
|
if(T == H) {
|
|
|
|
|
H = T->next;
|
|
|
|
|
free(T);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
while(p != NULL && p->next != T)
|
|
|
|
|
p = p->next;
|
|
|
|
|
p->next = T->next;
|
|
|
|
|
free(T);
|
|
|
|
|
}
|
|
|
|
|
T = H;
|
|
|
|
|
FILE *fp = fopen("book.txt", "w");
|
|
|
|
|
while(T != NULL) {
|
|
|
|
|
fprintf(fp, "%s %s %s %s %d\n", T->name, T->author, T->type, T->publish, T->number);
|
|
|
|
|
T = T->next;
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
color(12);
|
|
|
|
|
printf("ɾ<EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>");
|
|
|
|
|
tp(39, 26);
|
|
|
|
|
color(11);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
tp(39, 28);
|
|
|
|
|
getch();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void del_question() {
|
|
|
|
|
cls();
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 8);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->name);
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->author);
|
|
|
|
|
tp(39, 12);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->type);
|
|
|
|
|
tp(39, 14);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->publish);
|
|
|
|
|
tp(39, 16);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%d", T->number);
|
|
|
|
|
color(12);
|
|
|
|
|
tp(39, 18);
|
|
|
|
|
printf("<EFBFBD>Ƿ<EFBFBD>ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD>");
|
|
|
|
|
tp(39, 20);
|
|
|
|
|
printf("| 1.<2E><> |");
|
|
|
|
|
tp(39, 22);
|
|
|
|
|
printf("| 2.<2E><> |");
|
|
|
|
|
tp(39, 24);
|
|
|
|
|
switch(getch()) {
|
|
|
|
|
case '1':del_();break;
|
|
|
|
|
case '2':break;
|
|
|
|
|
case '\e':adm_menu();
|
|
|
|
|
default :del_question();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void delete_book() {
|
|
|
|
|
cls();
|
|
|
|
|
int x = 0;
|
|
|
|
|
struct BOOK t;
|
|
|
|
|
color(12);
|
|
|
|
|
tp(39, 8);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
tp(39, 12);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
tp(39, 14);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
color(8);
|
|
|
|
|
tp(39, 16);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ESC<EFBFBD><EFBFBD><EFBFBD>ز˵<EFBFBD>");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(44, 10);
|
|
|
|
|
user_name(10, t.name, -1);
|
|
|
|
|
tp(44, 12);
|
|
|
|
|
user_name(12, t.author, -1);
|
|
|
|
|
tp(46, 14);
|
|
|
|
|
user_name(14, t.publish, 1);
|
|
|
|
|
tp(39, 18);
|
|
|
|
|
read_book();
|
|
|
|
|
T = H;
|
|
|
|
|
while(T != NULL) {
|
|
|
|
|
if(!strcmp(t.name, T->name) && !strcmp(t.author, T->author) && !strcmp(t.publish, T->publish)) {
|
|
|
|
|
x = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
T = T->next;
|
|
|
|
|
}
|
|
|
|
|
if(x)
|
|
|
|
|
del_question();
|
|
|
|
|
else
|
|
|
|
|
no_info();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void print() {
|
|
|
|
|
printf("-------------------------------------------------------------------------------------------------\n");
|
|
|
|
|
printf(" <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("-------------------------------------------------------------------------------------------------\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void All() {
|
|
|
|
|
cls();
|
|
|
|
|
int x = 3;
|
|
|
|
|
read_book();
|
|
|
|
|
print();
|
|
|
|
|
T = H;
|
|
|
|
|
color(12);
|
|
|
|
|
while(T != NULL) {
|
|
|
|
|
tp(0, x);
|
|
|
|
|
printf("%s", T->name);
|
|
|
|
|
tp(24, x);
|
|
|
|
|
printf("%s", T->author);
|
|
|
|
|
tp(45, x);
|
|
|
|
|
printf("%s", T->type);
|
|
|
|
|
tp(65, x);
|
|
|
|
|
printf("%s", T->publish);
|
|
|
|
|
tp(88, x);
|
|
|
|
|
printf("%d", T->number);
|
|
|
|
|
x++;
|
|
|
|
|
T = T->next;
|
|
|
|
|
}
|
|
|
|
|
color(11);
|
|
|
|
|
printf("\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
getch();
|
|
|
|
|
cls();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Auth() {
|
|
|
|
|
cls();
|
|
|
|
|
int z = 0, x = 3;
|
|
|
|
|
char t[21];
|
|
|
|
|
color(12);
|
|
|
|
|
tp(39, 8);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>߲<EFBFBD>ѯ");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
color(8);
|
|
|
|
|
tp(39, 12);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ESC<EFBFBD><EFBFBD><EFBFBD>ز˵<EFBFBD>");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(60, 10);
|
|
|
|
|
user_name(10, t, 15);
|
|
|
|
|
tp(39, 14);
|
|
|
|
|
read_book();
|
|
|
|
|
T = H;
|
|
|
|
|
color(12);
|
|
|
|
|
while(T != NULL) {
|
|
|
|
|
if(strcmp(t, T->author) == 0 && z == 0) {
|
|
|
|
|
cls();
|
|
|
|
|
print();
|
|
|
|
|
tp(0, x);
|
|
|
|
|
printf("%s", T->name);
|
|
|
|
|
tp(24, x);
|
|
|
|
|
printf("%s", T->author);
|
|
|
|
|
tp(45, x);
|
|
|
|
|
printf("%s", T->type);
|
|
|
|
|
tp(65, x);
|
|
|
|
|
printf("%s", T->publish);
|
|
|
|
|
tp(88, x);
|
|
|
|
|
printf("%d", T->number);
|
|
|
|
|
x++;
|
|
|
|
|
z++;
|
|
|
|
|
}
|
|
|
|
|
else if(strcmp(t, T->author) == 0) {
|
|
|
|
|
tp(0, x);
|
|
|
|
|
printf("%s", T->name);
|
|
|
|
|
tp(24, x);
|
|
|
|
|
printf("%s", T->author);
|
|
|
|
|
tp(45, x);
|
|
|
|
|
printf("%s", T->type);
|
|
|
|
|
tp(65, x);
|
|
|
|
|
printf("%s", T->publish);
|
|
|
|
|
tp(88, x);
|
|
|
|
|
printf("%d", T->number);
|
|
|
|
|
x++;
|
|
|
|
|
}
|
|
|
|
|
T = T->next;
|
|
|
|
|
}
|
|
|
|
|
if(z == 0) {
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><EFBFBD><EFBFBD>Ϣ");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 16);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
getch();
|
|
|
|
|
cls();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
color(11);
|
|
|
|
|
printf("\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
getch();
|
|
|
|
|
cls();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Type() {
|
|
|
|
|
cls();
|
|
|
|
|
int z = 0, x = 3;
|
|
|
|
|
char t[21];
|
|
|
|
|
color(12);
|
|
|
|
|
tp(39, 8);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD>ѯ");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
color(8);
|
|
|
|
|
tp(39, 12);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ESC<EFBFBD><EFBFBD><EFBFBD>ز˵<EFBFBD>");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(60, 10);
|
|
|
|
|
user_name(10, t, 15);
|
|
|
|
|
tp(39, 14);
|
|
|
|
|
read_book();
|
|
|
|
|
T = H;
|
|
|
|
|
color(12);
|
|
|
|
|
while(T != NULL) {
|
|
|
|
|
if(strcmp(t, T->type) == 0 && z == 0) {
|
|
|
|
|
cls();
|
|
|
|
|
print();
|
|
|
|
|
tp(0, x);
|
|
|
|
|
printf("%s", T->name);
|
|
|
|
|
tp(24, x);
|
|
|
|
|
printf("%s", T->author);
|
|
|
|
|
tp(45, x);
|
|
|
|
|
printf("%s", T->type);
|
|
|
|
|
tp(65, x);
|
|
|
|
|
printf("%s", T->publish);
|
|
|
|
|
tp(88, x);
|
|
|
|
|
printf("%d", T->number);
|
|
|
|
|
x++;
|
|
|
|
|
z++;
|
|
|
|
|
}
|
|
|
|
|
else if(strcmp(t, T->type) == 0) {
|
|
|
|
|
tp(0, x);
|
|
|
|
|
printf("%s", T->name);
|
|
|
|
|
tp(24, x);
|
|
|
|
|
printf("%s", T->author);
|
|
|
|
|
tp(45, x);
|
|
|
|
|
printf("%s", T->type);
|
|
|
|
|
tp(65, x);
|
|
|
|
|
printf("%s", T->publish);
|
|
|
|
|
tp(88, x);
|
|
|
|
|
printf("%d", T->number);
|
|
|
|
|
x++;
|
|
|
|
|
}
|
|
|
|
|
T = T->next;
|
|
|
|
|
}
|
|
|
|
|
if(z == 0) {
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><EFBFBD><EFBFBD>Ϣ");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 16);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
getch();
|
|
|
|
|
cls();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
color(11);
|
|
|
|
|
printf("\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
getch();
|
|
|
|
|
cls();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Publish() {
|
|
|
|
|
cls();
|
|
|
|
|
int z = 0, x = 3;
|
|
|
|
|
char t[21];
|
|
|
|
|
color(12);
|
|
|
|
|
tp(39, 8);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ѯ<EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
color(8);
|
|
|
|
|
tp(39, 12);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ESC<EFBFBD><EFBFBD><EFBFBD>ز˵<EFBFBD>");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(62, 10);
|
|
|
|
|
user_name(10, t, 17);
|
|
|
|
|
tp(39, 14);
|
|
|
|
|
read_book();
|
|
|
|
|
T = H;
|
|
|
|
|
color(12);
|
|
|
|
|
while(T != NULL) {
|
|
|
|
|
if(strcmp(t, T->publish) == 0 && z == 0) {
|
|
|
|
|
cls();
|
|
|
|
|
print();
|
|
|
|
|
tp(0, x);
|
|
|
|
|
printf("%s", T->name);
|
|
|
|
|
tp(24, x);
|
|
|
|
|
printf("%s", T->author);
|
|
|
|
|
tp(45, x);
|
|
|
|
|
printf("%s", T->type);
|
|
|
|
|
tp(65, x);
|
|
|
|
|
printf("%s", T->publish);
|
|
|
|
|
tp(88, x);
|
|
|
|
|
printf("%d", T->number);
|
|
|
|
|
x++;
|
|
|
|
|
z++;
|
|
|
|
|
}
|
|
|
|
|
else if(strcmp(t, T->publish) == 0) {
|
|
|
|
|
tp(0, x);
|
|
|
|
|
printf("%s", T->name);
|
|
|
|
|
tp(24, x);
|
|
|
|
|
printf("%s", T->author);
|
|
|
|
|
tp(45, x);
|
|
|
|
|
printf("%s", T->type);
|
|
|
|
|
tp(65, x);
|
|
|
|
|
printf("%s", T->publish);
|
|
|
|
|
tp(88, x);
|
|
|
|
|
printf("%d", T->number);
|
|
|
|
|
x++;
|
|
|
|
|
}
|
|
|
|
|
T = T->next;
|
|
|
|
|
}
|
|
|
|
|
if(z == 0) {
|
|
|
|
|
printf("<EFBFBD>ó<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 16);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
getch();
|
|
|
|
|
cls();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
color(11);
|
|
|
|
|
printf("\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
getch();
|
|
|
|
|
cls();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void lend_user() {
|
|
|
|
|
cls();
|
|
|
|
|
read_lend();
|
|
|
|
|
Temp = Head;
|
|
|
|
|
int z = 0, x = 3;
|
|
|
|
|
color(12);
|
|
|
|
|
while(Temp != NULL) {
|
|
|
|
|
if(!strcmp(Temp->user, TEMP->name) && z == 0) {
|
|
|
|
|
color(11);
|
|
|
|
|
printf("-------------------------------------------------------------------------------------------------\n");
|
|
|
|
|
printf(" <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("-------------------------------------------------------------------------------------------------\n");
|
|
|
|
|
color(12);
|
|
|
|
|
tp(0, x);
|
|
|
|
|
printf("%s", Temp->name);
|
|
|
|
|
tp(28, x);
|
|
|
|
|
printf("%s", Temp->author);
|
|
|
|
|
tp(54, x);
|
|
|
|
|
printf("%s", Temp->type);
|
|
|
|
|
tp(80, x);
|
|
|
|
|
printf("%s", Temp->publish);
|
|
|
|
|
x++;
|
|
|
|
|
z++;
|
|
|
|
|
}
|
|
|
|
|
else if(!strcmp(Temp->user, TEMP->name)) {
|
|
|
|
|
tp(0, x);
|
|
|
|
|
printf("%s", Temp->name);
|
|
|
|
|
tp(28, x);
|
|
|
|
|
printf("%s", Temp->author);
|
|
|
|
|
tp(54, x);
|
|
|
|
|
printf("%s", Temp->type);
|
|
|
|
|
tp(80, x);
|
|
|
|
|
printf("%s", Temp->publish);
|
|
|
|
|
x++;
|
|
|
|
|
}
|
|
|
|
|
Temp = Temp->next;
|
|
|
|
|
}
|
|
|
|
|
if(z == 0) {
|
|
|
|
|
tp(39, 8);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>ͼ<EFBFBD><EFBFBD>");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
getch();
|
|
|
|
|
cls();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
color(11);
|
|
|
|
|
printf("\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
getch();
|
|
|
|
|
cls();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void view1_book() {
|
|
|
|
|
cls();
|
|
|
|
|
g = 1;
|
|
|
|
|
color(12);
|
|
|
|
|
tp(39, 8);
|
|
|
|
|
printf("ͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
printf("| 1.ȫ<><C8AB> |");
|
|
|
|
|
tp(39, 12);
|
|
|
|
|
printf("| 2.<2E><><EFBFBD>߲<EFBFBD>ѯ |");
|
|
|
|
|
tp(39, 14);
|
|
|
|
|
printf("| 3.<2E><><EFBFBD>Ͳ<EFBFBD>ѯ |");
|
|
|
|
|
tp(39, 16);
|
|
|
|
|
printf("| 4.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ |");
|
|
|
|
|
tp(39, 18);
|
|
|
|
|
printf("| 5.<2E>ѽ<EFBFBD>ͼ<EFBFBD><CDBC> |");
|
|
|
|
|
tp(39, 20);
|
|
|
|
|
printf("| 6.<2E><><EFBFBD>ز˵<D8B2> |");
|
|
|
|
|
tp(39, 22);
|
|
|
|
|
printf("| 7.<2E>˳<EFBFBD> |");
|
|
|
|
|
switch(getch()) {
|
|
|
|
|
case '1':All();view1_book();
|
|
|
|
|
case '2':Auth();view1_book();
|
|
|
|
|
case '3':Type();view1_book();
|
|
|
|
|
case '4':Publish();view1_book();
|
|
|
|
|
case '5':lend_user();view1_book();
|
|
|
|
|
case '6':g = 0;stu_menu();
|
|
|
|
|
case '7':exit(0);
|
|
|
|
|
case '\e':g = 0;stu_menu();
|
|
|
|
|
default :view1_book();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void lend_() {
|
|
|
|
|
cls();
|
|
|
|
|
printf("-------------------------------------------------------------------------------------------------\n");
|
|
|
|
|
printf(" <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("-------------------------------------------------------------------------------------------------\n");
|
|
|
|
|
read_lend();
|
|
|
|
|
Temp = Head;
|
|
|
|
|
int x = 3;
|
|
|
|
|
color(12);
|
|
|
|
|
while(Temp != NULL) {
|
|
|
|
|
tp(0, x);
|
|
|
|
|
printf("%s", Temp->name);
|
|
|
|
|
tp(24, x);
|
|
|
|
|
printf("%s", Temp->author);
|
|
|
|
|
tp(45, x);
|
|
|
|
|
printf("%s", Temp->type);
|
|
|
|
|
tp(65, x);
|
|
|
|
|
printf("%s", Temp->publish);
|
|
|
|
|
tp(88, x);
|
|
|
|
|
printf("%s", Temp->user);
|
|
|
|
|
x++;
|
|
|
|
|
Temp = Temp->next;
|
|
|
|
|
}
|
|
|
|
|
color(11);
|
|
|
|
|
printf("\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
getch();
|
|
|
|
|
cls();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void view2_book() {
|
|
|
|
|
cls();
|
|
|
|
|
g = 1;
|
|
|
|
|
color(12);
|
|
|
|
|
tp(39, 8);
|
|
|
|
|
printf("ͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
printf("| 1.ȫ<><C8AB> |");
|
|
|
|
|
tp(39, 12);
|
|
|
|
|
printf("| 2.<2E><><EFBFBD>߲<EFBFBD>ѯ |");
|
|
|
|
|
tp(39, 14);
|
|
|
|
|
printf("| 3.<2E><><EFBFBD>Ͳ<EFBFBD>ѯ |");
|
|
|
|
|
tp(39, 16);
|
|
|
|
|
printf("| 4.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ |");
|
|
|
|
|
tp(39, 18);
|
|
|
|
|
printf("| 5.<2E>ѽ<EFBFBD>ͼ<EFBFBD><CDBC> |");
|
|
|
|
|
tp(39, 20);
|
|
|
|
|
printf("| 6.<2E><><EFBFBD>ز˵<D8B2> |");
|
|
|
|
|
tp(39, 22);
|
|
|
|
|
printf("| 7.<2E>˳<EFBFBD> |");
|
|
|
|
|
switch(getch()) {
|
|
|
|
|
case '1':All();view2_book();
|
|
|
|
|
case '2':Auth();view2_book();
|
|
|
|
|
case '3':Type();view2_book();
|
|
|
|
|
case '4':Publish();view2_book();
|
|
|
|
|
case '5':lend_();view2_book();
|
|
|
|
|
case '6':g = 0;adm_menu();
|
|
|
|
|
case '7':exit(0);
|
|
|
|
|
case '\e':g = 0;adm_menu();
|
|
|
|
|
default :view2_book();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void view_user() {
|
|
|
|
|
cls();
|
|
|
|
|
read_user();
|
|
|
|
|
printf("-------------------------------------------------------------------------------------------------\n");
|
|
|
|
|
printf(" <20><><EFBFBD><EFBFBD> <20>ʺ<EFBFBD> <20><><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("-------------------------------------------------------------------------------------------------\n");
|
|
|
|
|
color(12);
|
|
|
|
|
TEMP = HEAD;
|
|
|
|
|
while(TEMP != NULL) {
|
|
|
|
|
printf("%22s %28s %23s\n", TEMP->name, TEMP->user_id, TEMP->password);
|
|
|
|
|
TEMP = TEMP->next;
|
|
|
|
|
}
|
|
|
|
|
color(11);
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
getch();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void del_user() {
|
|
|
|
|
struct STUDENT *p = HEAD;
|
|
|
|
|
if(TEMP == HEAD) {
|
|
|
|
|
HEAD = TEMP->next;
|
|
|
|
|
free(TEMP);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
while(p != NULL && p->next != TEMP)
|
|
|
|
|
p = p->next;
|
|
|
|
|
p->next = TEMP->next;
|
|
|
|
|
free(TEMP);
|
|
|
|
|
}
|
|
|
|
|
TEMP = HEAD;
|
|
|
|
|
FILE *fp = fopen("user.txt", "w");
|
|
|
|
|
while(TEMP != NULL) {
|
|
|
|
|
fprintf(fp, "%s %s %s\n", TEMP->name, TEMP->user_id, TEMP->password);
|
|
|
|
|
TEMP = TEMP->next;
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
color(12);
|
|
|
|
|
printf("ɾ<EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD>ɹ<EFBFBD>");
|
|
|
|
|
tp(39, 26);
|
|
|
|
|
color(11);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
tp(39, 28);
|
|
|
|
|
getch();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void change_user_ques() {
|
|
|
|
|
cls();
|
|
|
|
|
color(12);
|
|
|
|
|
tp(39, 8);
|
|
|
|
|
printf("<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>Ϣ");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", TEMP->name);
|
|
|
|
|
tp(39, 12);
|
|
|
|
|
printf("<EFBFBD>ʺ<EFBFBD>:%s", TEMP->user_id);
|
|
|
|
|
tp(39, 14);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", TEMP->password);
|
|
|
|
|
color(12);
|
|
|
|
|
tp(39, 16);
|
|
|
|
|
printf("<EFBFBD>Ƿ<EFBFBD><EFBFBD>ĸ<EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>Ϣ");
|
|
|
|
|
tp(39, 18);
|
|
|
|
|
printf("| 1.<2E><> |");
|
|
|
|
|
tp(39, 20);
|
|
|
|
|
printf("| 2.<2E><> |");
|
|
|
|
|
tp(39, 22);
|
|
|
|
|
printf("| 9.ɾ<><C9BE><EFBFBD>û<EFBFBD> |");
|
|
|
|
|
tp(39, 24);
|
|
|
|
|
switch(getch()) {
|
|
|
|
|
case '1':break;
|
|
|
|
|
case '2':adm_menu();
|
|
|
|
|
case '9':del_user();adm_menu();
|
|
|
|
|
case '\e':adm_menu();
|
|
|
|
|
default :change_user_ques();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void change_user() {
|
|
|
|
|
cls();
|
|
|
|
|
int x = 0;
|
|
|
|
|
char user[21];
|
|
|
|
|
read_user();
|
|
|
|
|
color(12);
|
|
|
|
|
tp(36, 8);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ĵ<EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʺ<EFBFBD>");
|
|
|
|
|
color(8);
|
|
|
|
|
tp(45, 12);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ESC<EFBFBD><EFBFBD><EFBFBD>ز˵<EFBFBD>");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(45, 10);
|
|
|
|
|
user_name(10, user, 0);
|
|
|
|
|
tp(44, 14);
|
|
|
|
|
TEMP = HEAD;
|
|
|
|
|
while(TEMP != NULL) {
|
|
|
|
|
if(!strcmp(user, TEMP->name) || !strcmp(user, TEMP->user_id)) {
|
|
|
|
|
x = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
TEMP = TEMP->next;
|
|
|
|
|
}
|
|
|
|
|
if(x) {
|
|
|
|
|
change_user_ques();
|
|
|
|
|
cls();
|
|
|
|
|
color(11);
|
|
|
|
|
tp(30, 8);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", TEMP->name);
|
|
|
|
|
tp(54, 8);
|
|
|
|
|
printf("->");
|
|
|
|
|
tp(30, 10);
|
|
|
|
|
printf("<EFBFBD>ʺ<EFBFBD>:%s", TEMP->user_id);
|
|
|
|
|
tp(54, 10);
|
|
|
|
|
printf("->");
|
|
|
|
|
tp(30, 12);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", TEMP->password);
|
|
|
|
|
tp(54, 12);
|
|
|
|
|
printf("->");
|
|
|
|
|
color(8);
|
|
|
|
|
tp(45, 14);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ESC<EFBFBD><EFBFBD><EFBFBD>ز˵<EFBFBD>");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(64, 8);
|
|
|
|
|
user_name(8, TEMP->name, 19);
|
|
|
|
|
tp(64, 10);
|
|
|
|
|
user_name(10, TEMP->user_id, 19);
|
|
|
|
|
tp(64, 12);
|
|
|
|
|
v = 1;
|
|
|
|
|
user_name(12, TEMP->password, 19);
|
|
|
|
|
v = 0;
|
|
|
|
|
tp(45, 16);
|
|
|
|
|
TEMP = HEAD;
|
|
|
|
|
FILE *fp = fopen("user.txt", "w");
|
|
|
|
|
while(TEMP != NULL) {
|
|
|
|
|
fprintf(fp, "%s %s %s\n", TEMP->name, TEMP->user_id, TEMP->password);
|
|
|
|
|
TEMP = TEMP->next;
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
cls();
|
|
|
|
|
color(12);
|
|
|
|
|
tp(39, 8);
|
|
|
|
|
printf("<EFBFBD>ijɹ<EFBFBD>");
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
color(11);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
tp(39, 12);
|
|
|
|
|
getch();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
color(12);
|
|
|
|
|
printf("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(45, 16);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
tp(45, 18);
|
|
|
|
|
getch();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Num(int a) {
|
|
|
|
|
int x = 0;
|
|
|
|
|
read_lend();
|
|
|
|
|
if(a == -1) {
|
|
|
|
|
Temp = Head;
|
|
|
|
|
while(Temp != NULL) {
|
|
|
|
|
if(!strcmp(Temp->name, T->name) && !strcmp(Temp->author, T->author) && !strcmp(Temp->type, T->type) && !strcmp(Temp->publish, T->publish) && !strcmp(Temp->user, TEMP->name)) {
|
|
|
|
|
x = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
Temp = Temp->next;
|
|
|
|
|
}
|
|
|
|
|
if(x == 1) {
|
|
|
|
|
tp(39, 18);
|
|
|
|
|
printf(" ");
|
|
|
|
|
tp(39, 20);
|
|
|
|
|
printf(" ");
|
|
|
|
|
tp(39, 22);
|
|
|
|
|
printf(" ");
|
|
|
|
|
color(12);
|
|
|
|
|
tp(39, 18);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ѽ<EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>ȹ黹");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 20);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
tp(39, 22);
|
|
|
|
|
getch();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
FILE *fp = fopen("lend.txt", "a+");
|
|
|
|
|
fprintf(fp, "%s %s %s %s %s\n", T->name, T->author, T->type, T->publish, TEMP->name);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
Temp = Head;
|
|
|
|
|
while(Temp != NULL) {
|
|
|
|
|
if(!strcmp(Temp->name, T->name) && !strcmp(Temp->author, T->author) && !strcmp(Temp->type, T->type) && !strcmp(Temp->publish, T->publish) && !strcmp(Temp->user, TEMP->name)) {
|
|
|
|
|
x = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
Temp = Temp->next;
|
|
|
|
|
}
|
|
|
|
|
if(x == 1) {
|
|
|
|
|
struct BOOK *p = Head;
|
|
|
|
|
if(Temp == Head) {
|
|
|
|
|
Head = Temp->next;
|
|
|
|
|
free(Temp);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
while(p != NULL && p->next != Temp)
|
|
|
|
|
p = p->next;
|
|
|
|
|
p->next = Temp->next;
|
|
|
|
|
free(Temp);
|
|
|
|
|
}
|
|
|
|
|
Temp = Head;
|
|
|
|
|
FILE *fp = fopen("lend.txt", "w");
|
|
|
|
|
while(Temp != NULL) {
|
|
|
|
|
fprintf(fp, "%s %s %s %s %s\n", Temp->name, Temp->author, Temp->type, Temp->publish, Temp->user);
|
|
|
|
|
Temp = Temp->next;
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
tp(39, 18);
|
|
|
|
|
printf(" ");
|
|
|
|
|
tp(39, 20);
|
|
|
|
|
printf(" ");
|
|
|
|
|
tp(39, 22);
|
|
|
|
|
printf(" ");
|
|
|
|
|
color(12);
|
|
|
|
|
tp(39, 18);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȿ<EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD>Ա)");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 20);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
tp(39, 22);
|
|
|
|
|
getch();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
T->number += a;
|
|
|
|
|
for(i = H; i != NULL; i = i->next)
|
|
|
|
|
for(j = i->next; j != NULL; j = j->next)
|
|
|
|
|
if(i->number > j->number) {
|
|
|
|
|
Swap(i->name, j->name);
|
|
|
|
|
Swap(i->author, j->author);
|
|
|
|
|
Swap(i->type, j->type);
|
|
|
|
|
Swap(i->publish, j->publish);
|
|
|
|
|
Swap_num(&i->number, &j->number);
|
|
|
|
|
}
|
|
|
|
|
T = H;
|
|
|
|
|
FILE *fp = fopen("book.txt", "w");
|
|
|
|
|
while(T != NULL) {
|
|
|
|
|
fprintf(fp, "%s %s %s %s %d\n", T->name, T->author, T->type, T->publish, T->number);
|
|
|
|
|
T = T->next;
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
cls();
|
|
|
|
|
color(12);
|
|
|
|
|
tp(39, 8);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>");
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
color(11);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
tp(39, 12);
|
|
|
|
|
getch();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void book_printf(int a) {
|
|
|
|
|
cls();
|
|
|
|
|
tp(39, 8);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->name);
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->author);
|
|
|
|
|
tp(39, 12);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->type);
|
|
|
|
|
tp(39, 14);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s", T->publish);
|
|
|
|
|
tp(39, 16);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%d", T->number);
|
|
|
|
|
tp(39, 18);
|
|
|
|
|
if(T->number == 0 && a == -1) {
|
|
|
|
|
color(12);
|
|
|
|
|
printf("<EFBFBD>鱾<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 20);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
tp(39, 22);
|
|
|
|
|
getch();
|
|
|
|
|
}
|
|
|
|
|
else if(a == -1){
|
|
|
|
|
printf("<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
tp(39, 20);
|
|
|
|
|
printf("| 1.<2E><> |");
|
|
|
|
|
tp(39, 22);
|
|
|
|
|
printf("| 2.<2E><> |");
|
|
|
|
|
tp(39, 24);
|
|
|
|
|
switch(getch()) {
|
|
|
|
|
case '1':Num(a);break;
|
|
|
|
|
case '2':break;
|
|
|
|
|
case '\e':break;
|
|
|
|
|
default :book_printf(a);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
printf("<EFBFBD>Ƿ<EFBFBD><EFBFBD>黹");
|
|
|
|
|
tp(39, 20);
|
|
|
|
|
printf("| 1.<2E><> |");
|
|
|
|
|
tp(39, 22);
|
|
|
|
|
printf("| 2.<2E><> |");
|
|
|
|
|
tp(39, 24);
|
|
|
|
|
switch(getch()) {
|
|
|
|
|
case '1':Num(a);break;
|
|
|
|
|
case '2':break;
|
|
|
|
|
case '\e':break;
|
|
|
|
|
default :book_printf(a);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void lend_book() {
|
|
|
|
|
if(search_book())
|
|
|
|
|
book_printf(-1);
|
|
|
|
|
else
|
|
|
|
|
no_info();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void remand_book() {
|
|
|
|
|
if(search_book())
|
|
|
|
|
book_printf(1);
|
|
|
|
|
else
|
|
|
|
|
no_info();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void stu_menu() {
|
|
|
|
|
cls();
|
|
|
|
|
color(12);
|
|
|
|
|
tp(36, 8);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>%s<><73>ӭ<EFBFBD><D3AD>ʹ<EFBFBD><CAB9>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ", TEMP->name);
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
printf("| 1.ͼ<><CDBC><EFBFBD><EFBFBD>ѯ |");
|
|
|
|
|
tp(39, 12);
|
|
|
|
|
printf("| 2.ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |");
|
|
|
|
|
tp(39, 14);
|
|
|
|
|
printf("| 3.ͼ<><CDBC><EFBFBD>黹 |");
|
|
|
|
|
tp(39, 16);
|
|
|
|
|
printf("| 4.ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |");
|
|
|
|
|
tp(39, 18);
|
|
|
|
|
printf("| 5.<2E><><EFBFBD>ص<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD> |");
|
|
|
|
|
tp(39, 20);
|
|
|
|
|
printf("| 6.<2E>˳<EFBFBD> |");
|
|
|
|
|
tp(39, 22);
|
|
|
|
|
switch(getch()) {
|
|
|
|
|
case '1':inquire1();stu_menu();
|
|
|
|
|
case '2':lend_book();stu_menu();
|
|
|
|
|
case '3':remand_book();stu_menu();
|
|
|
|
|
case '4':view1_book();stu_menu();
|
|
|
|
|
case '5':Login();
|
|
|
|
|
case '6':exit(0);
|
|
|
|
|
case '\e':exit(0);
|
|
|
|
|
default :stu_menu();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void adm_menu() {
|
|
|
|
|
cls();
|
|
|
|
|
adm_window();
|
|
|
|
|
color(12);
|
|
|
|
|
tp(36, 8);
|
|
|
|
|
printf("<EFBFBD>Ĺ<EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD>ӭ<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ");
|
|
|
|
|
color(11);
|
|
|
|
|
tp(39, 10);
|
|
|
|
|
printf("| 1.ͼ<><CDBC><EFBFBD><EFBFBD>ѯ |");
|
|
|
|
|
tp(39, 12);
|
|
|
|
|
printf("| 2.<2E><EFBFBD>ͼ<EFBFBD><CDBC> |");
|
|
|
|
|
tp(39, 14);
|
|
|
|
|
printf("| 3.<2E><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC> |");
|
|
|
|
|
tp(39, 16);
|
|
|
|
|
printf("| 4.ɾ<><C9BE>ͼ<EFBFBD><CDBC> |");
|
|
|
|
|
tp(39, 18);
|
|
|
|
|
printf("| 5.ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |");
|
|
|
|
|
tp(39, 20);
|
|
|
|
|
printf("| 6.<2E>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD> |");
|
|
|
|
|
tp(39, 22);
|
|
|
|
|
printf("| 7.<2E><EFBFBD><DEB8>û<EFBFBD> |");
|
|
|
|
|
tp(39, 24);
|
|
|
|
|
printf("| 8.<2E><><EFBFBD>ص<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD> |");
|
|
|
|
|
tp(39, 26);
|
|
|
|
|
printf("| 9.<2E>˳<EFBFBD> |");
|
|
|
|
|
tp(39, 28);
|
|
|
|
|
switch(getch()) {
|
|
|
|
|
case '1':inquire2();adm_menu();
|
|
|
|
|
case '2':change_book();adm_menu();
|
|
|
|
|
case '3':add_book();adm_menu();
|
|
|
|
|
case '4':delete_book();adm_menu();
|
|
|
|
|
case '5':view2_book();adm_menu();
|
|
|
|
|
case '6':view_user();adm_menu();
|
|
|
|
|
case '7':change_user();adm_menu();
|
|
|
|
|
case '8':recovery_window();Login();
|
|
|
|
|
case '9':exit(0);
|
|
|
|
|
case '\e':exit(0);
|
|
|
|
|
default :adm_menu();
|
|
|
|
|
}
|
|
|
|
|
}
|