2022年c语言图书管理标准系统.docx

上传人:Che****ry 文档编号:12785438 上传时间:2022-04-26 格式:DOCX 页数:59 大小:104.79KB
返回 下载 相关 举报
2022年c语言图书管理标准系统.docx_第1页
第1页 / 共59页
2022年c语言图书管理标准系统.docx_第2页
第2页 / 共59页
点击查看更多>>
资源描述

《2022年c语言图书管理标准系统.docx》由会员分享,可在线阅读,更多相关《2022年c语言图书管理标准系统.docx(59页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、精品学习资源#include #include #include #include #include #include #define Key_UP72#define Key_DOWN80#define Key_ENTER 28#define Key_N49#define Key_Y21#define LENsizeofstruct linklisttypedef struct book1/* 图书基本信息结构体 */char name20;char writer30 ;char type20 ;char num20 ;char time20 ;char press20;char editio

2、n20 ;char ISBN40 ;float price ;int count ;int lendnum ;bbasic ;/*图书资料基本信息:中图法分类号、图书编号、书名、作者(要考虑多个作者情形)、出版社、出版日期、 ISBN 、版次、定价、馆藏数、借阅数等;*/typedef struct book2/* 图书选购信息结构体 */char name20;char writer20 ;char time15 ;int num ;float price ;float money ;欢迎下载精品学习资源char bill 30 ;bpurchase;/*图书选购信息:书名、作者、选购日期、

3、选购数量、选购单价、选购金额、发票号码、图书编号等;*/typedef struct book3/* 图书借阅信息结构体 */*需要输入的信息 */ char name20;char person20 ;char company20 ;char num20 ;/* 借书证号 */ char btime15 ;/*运算可得信息 */char rtime15 ;char fine20 ;blend ;/*图书借阅信息:借阅人、借阅人所在单位、借书证号、所借书名、借阅日期、归仍日期、逾期罚款等;借阅期限为一个月,逾期1 天,罚款 1 角;*/struct linklistbbasic binfo ;

4、struct linklist *next ; ;int key ;void menu ;void _window ;void words ;void boxint,int,int,int; int _chooseint bot, int top ;void playint ;int readsum ;void add ;void addbook ;void addbuy ;欢迎下载精品学习资源void addborrow ;void manage ;struct linklist* create ;void modify ;void delete ;void insert ;void sea

5、rch;void searchname;void searchwriter ;void orderwbbasic binfo100;void orderwbbasic binfo100;int halfnint sum,bbasic binfo100,char *find;int halfwint sum,bbasic binfo100,char *find;void sta ;void blist ;void bmoney ;int mainvoidmenu;void menuint y ;_window ;words ;/* 显示窗口 */* 显示菜单文字 */y = choose7,19

6、;/* 光标 */playy ;/* 依据键盘值操作 */void _window/* 窗口初始化 */textbackgroundBLUE textcolorWHITE ;clrscr ;box1,1,24,80 ;欢迎下载精品学习资源void words/* 显示菜单文字 */textcolorWHITE ;gotoxy30,7 ;textbackgroundRED ;cprintfAdd Book info;textbackgroundBLUE ;gotoxy30,10 ;cprintfManage Book;gotoxy30,13 ;cprintfSearch Book ;gotoxy

7、30,16 ;cprintfBook Statistic;gotoxy30,19 ;cprintfExit;gotoxy35,22 ;textcolorLIGHTGRAY;textbackgroundBLUE ;cprintf Main Menu ;gotoxy25, 2 ;textcolorRED ;highvideo ;cprintfThe Library Managemnt Program;normvideo ;void boxint x,int y, int high, int width/* 画方框 */int i ;gotoxyx,y ;putchar0xda ;for i = 1

8、; i width - 1 ; i+putchar0xc4 ;putchar0xbf ;gotoxyx, y + high - 3 ;putchar0xc0 ;gotoxywidth, y + high - 3;putchar0xd9 ;for i = 1 ; i high - 1 ; i+gotoxyx,y+i ;putchar0xb3 ;欢迎下载精品学习资源gotoxyx + width -1, y+i;putchar0xb3 ;gotoxyx, y + high - 1 ;putchar0xc0 ;for i = 1; i width - 1 ; i+putchar0xc4 ;gotox

9、yx + 1, y + high - 3 ;for i = 1 ; i botupbary ;y = y - 3 ; ;break;欢迎下载精品学习资源case Key_DOWN:if y topdownbary ;y = y + 3 ; ;break;whileky .= Key_ENTER;return y;upbarint y/* 光标上移 */int i ;typedef struct texel_structunsigned char ch;unsigned char attr;texel ;texel t;fori=30 ; i=48 ;i+gettexti,y,i,y,&t ;t

10、.attr=0x1f ;puttexti,y,i,y,&t ;gettexti,y-3,i,y-3,&t;t.attr=0x4f ;puttexti,y-3,i,y-3,&t; ;gotoxy30,y-3 ;return;downbarint y/* 光标下移 */int i ;typedef struct texel_structunsigned char ch;unsigned char attr;texel ;texel t;欢迎下载精品学习资源fori=30 ; i=48 ;i+gettexti,y,i,y,&t ;t.attr=0x1f ;puttexti,y,i,y,&t ;get

11、texti,y+3,i,y+3,&t;t.attr=0x4f ;puttexti,y+3,i,y+3,&t; ;gotoxy30,y+3 ;return;void playint y/* 依据 y 的值选择操作 */switchycase7:add;break;case 10:manage;break;case 13:search;break;case 16:sta;break;case 19:exit1 ;default:printfError;exit0 ;void add/* 显示 选择增加那种类型的信息 的窗口 */int y ;_window ;gotoxy30,7 ;textbac

12、kgroundRED ;cprintfAdd Basic info;textbackgroundBLUE ;gotoxy30,10 ;cprintfAdd Purchase info;gotoxy30,13 ;cprintfAdd Borrow info;gotoxy30,16 ;欢迎下载精品学习资源cprintfBack ;gotoxy25, 2 ;textcolorRED ;highvideo ;cprintfThe Library Managemnt Program;normvideo ;gotoxy35,22 ;textcolorLIGHTGRAY;textbackgroundBLUE

13、 ;cprintf Add Book ;textbackgroundBLUE ;textcolorWHITE ;y=choose7,16 ;switchy/* 选择增加信息类型的函数*/case 7 :addbook;break;/* 增加图书基本信息*/ case 10:addbuy;break;/* 增加图书购买信息 */case 13:addborrow ;break;/* 增加图书借阅信息 */ case 16:menu;break;default:printfError;break;void addbook/* 增加图书基本信息*/int ky, sum = 0 ;FILE *fp

14、;bbasic binfo ;textbackgroundBLUE ;textcolorWHITE ;clrscr ;iffp = fopene:sum.dat,rb .= NULL/* 读取图书基本信息数量sum*/fread&sum,2,1,fp ;fclosefp ;if fp = fopene:addbook.dat,ab = NULLprintfcannot write the addbook.dat;欢迎下载精品学习资源doclrscr ;gotoxy2,2 ;cprintfPlease input the classfication of chinese library clas

15、sification:;scanf%s,&binfo.type;getchar;gotoxy2,4 ;cprintfPlease input the books number: ;scanf%s,&binfo.num;getchar;gotoxy2,6 ;cprintfPlease input the books name: ;scanf%s,&binfo.name ;getchar;gotoxy2,8 ;cprintfPlease input the books writer:;scanf%s,&binfo.writer;getchar;gotoxy2,10 ;cprintfPlease i

16、nput the the books press: ;scanf%s,&binfo.press ;getchar;gotoxy2,12 ;cprintfPlease input the books edition:;scanf%s,&binfo.edition;getchar;gotoxy2,14 ;cprintfPlease input the books publish time:;scanf%s,&binfo.time;getchar;gotoxy2,16 ;cprintfPlease input the price: ;scanf%f,&binfo.price;getchar;goto

17、xy2,18 ;cprintfPlease input the ISBN of the book:;scanf%s,&binfo.ISBN;getchar;gotoxy2,20 ;cprintfPlease input the count of books:;scanf%d,&binfo.count;getchar;欢迎下载精品学习资源gotoxy2,22 ;cprintfPlease input the lend number of the book:;scanf%d,&binfo.lendnum;getchar;gotoxy10,25 ;cprintfPress Nn to finish

18、add book or Press any key to add more book.;ky = key ;sum+;iffwrite&binfo,sizeofbbasic,1,fp .= 1clrscr ;printfcannot save the data. ;whileky .= Key_N;fclosefp ;if fp = fopene:sum.dat,wb = NULLprintfcannot save the sum of the book. ;getch;exit0 ;iffwrite&sum,2,1,fp .= 1printffail to write the sum.dat

19、.;getch;exit0 ; ;fclosefp ;menu;/*中图法分类号、 (要考虑多个作者情形) 、出版社、出版日期、ISBN 、版次、定价、馆藏数、借阅数等;*/void addbuy/* 增加图书购买信息 */int ky ;FILE *fp ;bpurchase pinfo;textbackgroundBLUE ;textcolorWHITE ;clrscr ;欢迎下载精品学习资源iffp = fopene:addbuy.dat,ab = NULLprintfcannot open the addbuy data. ;exit0 ;doclrscr ;gotoxy2,2 ;cp

20、rintfPlease input the books name: ;scanf%s,&pinfo.name ;gotoxy2,4 ;cprintfPlease input the books writer:;scanf%s,&pinfo.writer;gotoxy2,6 ;cprintfPlease input the books buy time:;scanf%s,&pinfo.writer;gotoxy2,8 ;cprintfPlease input the number of the book buy:;scanf%d,&pinfo.num;gotoxy2,10 ;cprintfPle

21、ase input the price: ;scanf%f,&pinfo.price;gotoxy2,12 ;cprintfPlease input the real money of buy the book:;scanf%f, &pinfo.money;gotoxy2,14 ;cprintfPlease input the bill number:;scanf%s, &pinfo.bill; gotoxy10,20 ;cprintfPress Nn to finish add book or Press any key to add more book.;ky = key ;iffwrit

22、e&pinfo,sizeofpinfo,1,fp .= 1clrscr ;printfcannot save the data. ;whileky .= Key_N;fclosefp ;menu;欢迎下载精品学习资源void addborrow/* 增加图书借阅信息 */int ky ;FILE *fp ;blend linfo ;textbackgroundBLUE ;textcolorWHITE ;clrscr ;iffp = fopene:addborrow.dat,ab = NULLprintfcannot open the addborrow data. ;exit0 ;doclrs

23、cr ;gotoxy2,2 ;cprintfPlease input the lend books name: ;scanf%s,&linfo.name ;gotoxy2,4 ;cprintfPlease input the borrowers name: ;scanf%s,&linfo.person ;gotoxy2,6 ;cprintfPlease input the company of the borrower:;scanf%s,&pany;gotoxy2,8 ;cprintfPlease input the borrowers card: ;scanf%s, &linfo.num;g

24、otoxy2,10 ;cprintfPlease input the borrow timeex.2021/01/26:;scanf%s, &linfo.btime;gotoxy2,12 ;cprintfPlease input the return timeex.2021/05/08:;scanf%s, &linfo.rtime;gotoxy10,20 ;cprintfPress Nn to finish add book or Press any key to add more book.;ky = key ;iffwrite&linfo,sizeoflinfo,1,fp .= 1欢迎下载

25、精品学习资源clrscr ;printfcannot save the data. ;whileky .= Key_N;fclosefp ;menu;struct linklist* create/* 创建链表 */int i, sum ;struct linklist *head, *p1, *p2;FILE *fp ;sum = readsum;p1 = struct linklist*mallocLEN;head = p2 = p1;if fp = fopene:addbook.dat,rb = NULLprintfcannot open the file. ;for i = 0 ; i

26、 next = p1 ;iffread&p2 - binfo,sizeofbbasic,1,fp .= 1printfcannot save the data. ;p2 - next = NULL;fclosefp ;return head;void modifystruct linklist* p,*head;char find30 ;欢迎下载精品学习资源int i,ky,sum ;FILE *fp ;p= head = create;sum = readsum;clrscr ;printfPlese input the name of the book you want to modify

27、:;scanf%s,find ;for i = 0 ;i binfo.name = 0gotoxy2,2 ;cprintfPlease input the classfication of chinese library classification:;scanf%s,&p - binfo.type;getchar;gotoxy2,4 ;cprintfPlease input the books number:;scanf%s,&p - binfo.num; getchar;gotoxy2,6 ;cprintfPlease input the books name: ;scanf%s,&p -

28、 binfo.name;getchar;gotoxy2,8 ;cprintfPlease input the books writer:;scanf%s,&p - binfo.writer;getchar;gotoxy2,10 ;cprintfPlease input the the books press: ;scanf%s,&p - binfo.press;getchar;gotoxy2,12 ;cprintfPlease input the books edition:;scanf%s,&p - binfo.edition;getchar;gotoxy2,14 ;cprintfPleas

29、e input the books publish time:;scanf%s,&p - binfo.time;getchar;gotoxy2,16 ;cprintfPlease input the price: ;scanf%f,&p - binfo.price;getchar;gotoxy2,18 ;欢迎下载精品学习资源cprintfPlease input the ISBN of the book:;scanf%s,&p - binfo.ISBN;getchar;gotoxy2,20 ;cprintfPlease input the count of books:;scanf%d,&p

30、- binfo.count;getchar;gotoxy2,22 ;cprintfPlease input the lend number of the book:;scanf%d,&p - binfo.lendnum;getchar;printfPress Y to continue or Press anykey to back to menu.;ky = key ;ifky = Key_Y欢迎下载精品学习资源elsep = head;i = -1 ;clrscr ;printfPlese input the name of the book you want to modify:;sca

31、nf%s,find ;p = head;if fp = fopene:addbook.dat,wb = NULL欢迎下载精品学习资源printfcannot open addbook.dat ;for i = 0 ;i binfo,sizeofbbasic,1,fp .= 1clrscr ;printfcannot save the data. ;p = p - next ;fclosefp ;menu;p = p - next ;欢迎下载精品学习资源clrscr ;printfcannot find the book.;getch;void deletestruct linklist* p1

32、,*p2,*head;char find30 ;int i,ky,sum,flag = 0 ;FILE *fp ;p1 = p2 = head = create;sum = readsum;clrscr ;printfPlese input the name of the book you want to Delete:;scanf%s,find ;ifstrcmpfind,head - binfo.name = 0欢迎下载精品学习资源elsehead = head -next;sum-;flag = 1 ;for i = 0 ;i next ;ifstrcmpfind,p1 - binfo.

33、name = 0欢迎下载精品学习资源elsep1 = p1 - next ;p2 - next = p1 ;sum -;flag = 1 ;break;p2 = p2 - next ;欢迎下载精品学习资源if flag .= 1printfcannot find the book.;getch;menu;p1 = head;if fp = fopene:addbook.dat,wb = NULLprintfcannot open addbook.dat ;for i = 0 ;i binfo,sizeofbbasic,1,fp .= 1clrscr ;printfcannot save the

34、 data. ;p1 = p1 - next ;fclosefp ;iffp = fopene:sum.dat,wb = NULLprintfcannot open sum.dat ;iffwrite&sum,2,1,fp .= 1printffail to write the sum.dat.;getch;exit0 ;fclosefp ;printfsucceed to delete the book.press anykey to get back to the mainmenu. ;getch;void insertstruct linklist* p1,*p2, *head, *te

35、mp;char find10 ;int i,ky,sum,flag = 0 ;FILE *fp ;欢迎下载精品学习资源clrscr ;sum = readsum;p1 = p2 = head = create;temp = struct linklist*mallocLEN; printfThe number you want to insert behind:;scanf%s,find ;fori = 0 ; inext ;ifstrcmpfind,p2 - binfo.num = 0欢迎下载精品学习资源elsep2 - next = temp ;temp - next =p1 ;sum +

36、 ;flag = 1 ;break;p2 = p2-next ;欢迎下载精品学习资源if flag .= 1printfcannot find the book.;getch;menu;clrscr ;gotoxy2,2 ;cprintfPlease input the classfication of chinese library classification:;scanf%s,&temp - binfo.type;getchar;gotoxy2,4 ;cprintfPlease input the books number: ;scanf%s,&temp - binfo.num;getc

37、har;gotoxy2,6 ;cprintfPlease input the books name: ;scanf%s,&temp - binfo.name;getchar;欢迎下载精品学习资源gotoxy2,8 ;cprintfPlease input the books writer:;scanf%s,&temp - binfo.writer;getchar;gotoxy2,10 ;cprintfPlease input the the books press: ;scanf%s,&temp - binfo.press;getchar;gotoxy2,12 ;cprintfPlease input the books ed

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 高考资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁