parent
72d387806e
commit
98f17f78ef
@ -0,0 +1,65 @@
|
|||||||
|
#ifndef BOOKS_H_INCLUDED
|
||||||
|
#define BOOKS_H_INCLUDED
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <conio.h>
|
||||||
|
#include <windows.h>
|
||||||
|
#include "user.h"
|
||||||
|
#include "BOOKUI.h"
|
||||||
|
#include "login.h"
|
||||||
|
#include "admin.h"
|
||||||
|
|
||||||
|
//#define "轻小说" 0
|
||||||
|
//#define "教育" 1
|
||||||
|
//#define "文学" 2
|
||||||
|
//#define "科幻" 3
|
||||||
|
//#define "自然科学" 4
|
||||||
|
//#define "外国文学" 5
|
||||||
|
//#define "禁书" 6
|
||||||
|
char *temp[1000];
|
||||||
|
FILE *fp_BOOK;
|
||||||
|
typedef struct memer_BOOK{
|
||||||
|
char id[21]; //编号
|
||||||
|
char name[21]; //书名
|
||||||
|
char author[21]; //作者
|
||||||
|
char type[21]; //类型 --->选项 类
|
||||||
|
char publish[21]; //出版社
|
||||||
|
int num; //数量 --->录入时查重,完全重复才++
|
||||||
|
struct memer_BOOK *next;
|
||||||
|
}BOOK;
|
||||||
|
|
||||||
|
char book1[21],book2[21],book3[21];
|
||||||
|
int booknum;
|
||||||
|
|
||||||
|
int books();
|
||||||
|
void newone_BOOK();
|
||||||
|
int newok_BOOK(char*id,char*name,char*author,char*type,char*publish,int num);
|
||||||
|
void showall_BOOK(int peo);
|
||||||
|
void in_BOOK();
|
||||||
|
void close_BOOK();
|
||||||
|
void save_BOOK();
|
||||||
|
void mpsort_BOOK();
|
||||||
|
void book_function_info(int choice);//用户功能菜单
|
||||||
|
void book_function_choose();//用户功能菜单的实现
|
||||||
|
void book_type_menu_info(int choice);//书本的类型菜单
|
||||||
|
int book_type_menu_choose();//书本的类型菜单的实现
|
||||||
|
void new_info();
|
||||||
|
void alter_BOOK_info();
|
||||||
|
void alter_BOOK();
|
||||||
|
void del_BOOK_info();
|
||||||
|
void del_BOOK();
|
||||||
|
void exchange_BOOK(char*,char*);
|
||||||
|
void conshow_BOOK(int fun,int peo);
|
||||||
|
void conshow_BOOK_choice(int peo);//0为user 1为admin
|
||||||
|
void conshow_BOOK_menu(int choice);
|
||||||
|
void borrowandreturn_BOOK_choice(int peo);//0为user 1为admin
|
||||||
|
void borrowandreturn_BOOK_menu(int choice);
|
||||||
|
void borrowandreturn_BOOK_info();
|
||||||
|
void borrow_BOOK(int peo);
|
||||||
|
void return_BOOK(int peo);
|
||||||
|
void change_password();
|
||||||
|
void back_BOOK(int peo);
|
||||||
|
|
||||||
|
#endif // BOOKS_H_INCLUDED
|
@ -0,0 +1,129 @@
|
|||||||
|
#include "BOOKUI.h"
|
||||||
|
|
||||||
|
char first[2][20] = {"登陆","注册"};
|
||||||
|
char login_uesr[2][20] = {"普通用户登陆","管理员登陆"};
|
||||||
|
|
||||||
|
void Settitle(char *title)//设置控制台标题
|
||||||
|
{
|
||||||
|
SetConsoleTitle(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setcolor(int forecolor,int bgcolor)
|
||||||
|
{
|
||||||
|
HANDLE win = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
|
SetConsoleTextAttribute(win,forecolor + bgcolor *0x10);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setposition(int x,int y)
|
||||||
|
{
|
||||||
|
HANDLE win = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
|
COORD pos = {x,y+3};
|
||||||
|
SetConsoleCursorPosition(win,pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void showtitle()//显示标题
|
||||||
|
{
|
||||||
|
setposition(LB,0);
|
||||||
|
printf("--------------------------------------------------------------");
|
||||||
|
setposition(LB,1);
|
||||||
|
printf("|");
|
||||||
|
setposition(LB+25,1);
|
||||||
|
printf("学生选课系统");
|
||||||
|
setposition(LB+61,1);
|
||||||
|
printf("|");
|
||||||
|
setposition(LB,2);
|
||||||
|
printf("--------------------------------------------------------------");
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < 8;i++){
|
||||||
|
setposition(LB,START+i);
|
||||||
|
printf("|");
|
||||||
|
setposition(LB+61,START+i);
|
||||||
|
printf("|");
|
||||||
|
}
|
||||||
|
setposition(LB,START+i);
|
||||||
|
printf("--------------------------------------------------------------");
|
||||||
|
}
|
||||||
|
|
||||||
|
void welcome()
|
||||||
|
{
|
||||||
|
int i,j = 0,k=-1;
|
||||||
|
for(i = 0; i <= 1;i++,k++)
|
||||||
|
{
|
||||||
|
if(choice == i)
|
||||||
|
setcolor(0,15);
|
||||||
|
setposition(LB+28,START+i+k+3);
|
||||||
|
printf("%s",first[j++]);
|
||||||
|
setcolor(11,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void comuser(int t)//用户登陆类型选择
|
||||||
|
{
|
||||||
|
int i,j = 0,k=-1;
|
||||||
|
for(i = 0; i <= 1;i++,k++)
|
||||||
|
{
|
||||||
|
if(t == i)
|
||||||
|
setcolor(0,15);
|
||||||
|
setposition(LB+25,START+i+k+3);
|
||||||
|
printf("%s",login_uesr[j++]);
|
||||||
|
setcolor(11,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HideCursor() //隐藏光标
|
||||||
|
{
|
||||||
|
CONSOLE_CURSOR_INFO cursor_info = {1, 0};
|
||||||
|
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void HideCursor2() //光标
|
||||||
|
{
|
||||||
|
CONSOLE_CURSOR_INFO cursor_info = {1, 1};
|
||||||
|
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
void clean()
|
||||||
|
{
|
||||||
|
printf(" ");
|
||||||
|
}
|
||||||
|
|
||||||
|
void player()
|
||||||
|
{
|
||||||
|
FILE *aim;
|
||||||
|
if((aim=fopen("aim.txt","r"))==NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
char page[70][220];
|
||||||
|
int i,hang=60;
|
||||||
|
while(!feof(aim))
|
||||||
|
{
|
||||||
|
Sleep(33);
|
||||||
|
HideCursor();
|
||||||
|
for(i = 0; i < hang;i++)
|
||||||
|
{
|
||||||
|
fgets(page[i],209,aim);
|
||||||
|
|
||||||
|
}
|
||||||
|
for(i = 10; i < hang-8; i++)
|
||||||
|
{
|
||||||
|
printf("%s",page[i]+10);
|
||||||
|
}
|
||||||
|
setposition(0,-3);
|
||||||
|
}
|
||||||
|
system("cls");
|
||||||
|
int n = 10;
|
||||||
|
char size[50] = "mode con cols=180 lines=50";
|
||||||
|
while(n--)
|
||||||
|
{
|
||||||
|
int cols = (size[15]-'0')*10+size[16]-'0'-7;
|
||||||
|
int lines = (size[24]-'0')*10+size[25]-'0'-2;
|
||||||
|
size[15] = cols/10+'0';
|
||||||
|
size[16] = cols%10+'0';
|
||||||
|
size[24] = lines/10+'0';
|
||||||
|
size[25] = lines%10+'0';
|
||||||
|
system(size);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue