基于C语言的图形用户界面图书管理系统含源代码_第1页
基于C语言的图形用户界面图书管理系统含源代码_第2页
基于C语言的图形用户界面图书管理系统含源代码_第3页
基于C语言的图形用户界面图书管理系统含源代码_第4页
基于C语言的图形用户界面图书管理系统含源代码_第5页
已阅读5页,还剩35页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

综合实验程序:图书管理系统设计实验目的及内容实实验要求新进图书根本信息的输入图书根本信息的查询对撤消图书信息的删除为读者〔即借书人〕办理注册,即添加读者查询:所有图书信息查询、所有读者信息查询办理借书手续:即修改书籍的借阅状态,添加读者的信息等办理还书手续:即修改书籍的借阅状态,删除读者的信息等系统设计方案系统结构图whilekey!=Esc)while(1)Add添加图书}}i}}}用户使用手册级菜单示进行操作实验步骤及核心代码#include<bios.h>#include<stdlib.h>#include<string.h>/*动态分配*//*strcmp(a1,a2);strcpy();*//*界面设计宏定义*/efinewcharT1[10]="NULL";charT2[10]="YES";charT3[10]="NO";/*键盘消息*/{intword;charbyte;{ekeyword}/*结构体声明*/typedefstructSTUDENT/*定义*/{charID[10];structSTUDENT*next;/*为创立链表所用,指向下一结点*/}STD;structbook/*定义*/{charbookID[5];charprice[10];charwritername[50];charlend[10];charreader[10];structbook*next2;/*为创立链表所用,指向下一结点*/};pfreevoidpeCreatbookppstructbookmallocsizeofstructbookpfreevoidpvoidErs(STD*h){STD*p=h,*q;while(p!=NULL){q=p;p=p->next;q}}voidErs1(structbook*h){structbook*p=h,*q;while(p!=NULL){q=p;pnextokq}}/*界面局部*/voidDialog(intx0,inty0,intiWidth,intiRow,char*sTitle,char*information[]){inti,j=0;windowxyiWidthxiRow+y0);textbackground(6);clrscr();window(x0,y0,x0+iWidth,iRow+4+y0);textbackground(WHITE);clrscr();/*复选框*/textcolor(RED);for(i=2;i<iWidth;i++){tchtchgotoxyiiRowputch;}for(i=2;i<4+iRow;i++){tchgotoxy(iWidth,i);putch(179);}gotoxy(iWidth,3);putch(180);gotoxy(iWidth,1);putch(191);gotoxy(iWidth,4+iRow);putch(217);textcolor(RED);cprintf("%s",sTitle);textcolor(0);for(i=4;i<=3+iRow;i++){icprintf("%s",information[j]);j++;}}voidxuanzhong(intT,intRow,intback_color,inttext_color,char*m,chark){if(k=='1')window(x1,y1,x1+w,y1+r+4);textbackground(back_color);textcolor(text_color);cprintf("%s",m);}voidfuxuankuang(intx0,inty0,intw0,intr0,char*m1,char*m2){inti;textbackground(6);clrscr();textcolor(0);cprintf("%s",m1);cprintf("%s",m2);gotoxywr}/*添加读者*/STD*Add1(STD*h){STD*p1,*p2,*p0,*p3;inti=1,j;while(i){tSTDpcprintf("inputreaderinformation(IDname)\r\n");cscanf("%s%s",p0->ID,p0->name);cprintf("\r\n");p2=h;p1=h->next;if(p1==NULL){h->next=p0;p0->next=NULL;}{while(p1&&strcmp(p0->ID,p1->ID)>0){}}cprintf("\r\n1.pressEscexit\r\n2.pressanykeytocontunieadd\r\n");j=get_key();clrscr();if(j==Esc)break;}returnh;}/*添加图书*/structbook*Add2(structbook*h){structbook*p1,*p2,*p0,*p3;inti=1,j;while(i){eatbookpcprintf("inputbookinformation(IDbooknamepricewritername)\r\n");cscanf("%s%s%s%s",bookIDpbooknameppricepwriternamercpypreaderTstrcpyplendTnextif(p1==NULL){h->next2=p0;p0->next2=NULL;}{while(p1&&strcmp(p0->bookID,p1->bookID)>0)/*注意p1的位置*/{}}cprintf("\r\n1.pressEscexit\r\n2.pressanykeytocontunieadd\r\n");j=get_key();clrscr();if(j==Esc)break;}returnh;}/*读者打印*/voidprintAll1(STD*h,structbook*h2){STD*p;inti=1,j=0;structbook*p1;p=h->next;if(!p)cprintf("nostudent\r\n");while(p){cprintf("%d:ID:%s,name:%s\r\n",i,p->ID,p->name);hilep{if(strcmp(p->ID,p1->reader)==0){j=1;cprintf("bookname:%s,ID:%s,price:%s,writername:%s\r\n",booknamepbookIDppricepwritername}}if(!j)cprintf("noborrow\r\n");p=p->next;i++;j=0;}cprintf("\r\npressanykeytocontunie\r\n");clrscr();}/*图书打印*/voidprintAll2(structbook*h){structbook*p;inti=1;nextif(!p)cprintf("nobookinformation\r\n");while(p){cprintf("%d:ID:%s,bookname:%s,price:%s,writername:%s,lend:%s\r\n",i,p->bookID,p->bookname,p->price,p->writername,p->lend);p=p->next2;i++;}cprintf("\r\npressanykeytocontunie\r\n");clrscr();}/*查找读者*/DSearchSTDhstructbookh{charxuehao[5],m;STD*p;intj=0;structbook*p1;ile{cprintf("inputreaderinformation(ID):");cscanf("%s",xuehao);cprintf("\r\n");p=h->next;while(p){if(strcmp(p->ID,xuehao)==0)break;p=p->next;}if(!p){cprintf("noinformation\r\n");}{cprintf("ID:%s,name:%s\r\n",p->ID,p->name);hilep{if(strcmp(p->ID,p1->reader)==0){j=1;cprintf("bookname:%s,ID:%s,price:%s,writername:%s\r\n",booknamepbookIDppricepwritername}}if(!j)cprintf("noborrow\r\n");}cprintf("\r\n1.pressEscexit\r\n2.pressanykeytocontuniesearch\r\n");j=get_key();clrscr();if(j==Esc)break;}}/*查找图书*/structbook*Search2(structbook*h){charxuehao[5],m;structbook*p;intj;ile{cprintf("inputbookinformation(ID):");cscanf("%s",xuehao);nextwhile(p){if(strcmp(p->bookID,xuehao)==0)break;xt}if(!p)cprintf("noinformation\r\n");}{gotoxy(1,2);cprintf("ID:%s,bookname:%s,price:%s,writername:%s,lend:%s\r\n",p->bookID,p->bookname,p->price,p->writername,p->lend);}cprintf("\r\n1.pressEscexit\r\n2.pressanykeytocontunieadd\r\n");j=get_key();clrscr();if(j==Esc)break;}}/*删除读者*/{STD*p1,*p2,*p0,*p3;intj;{tSTDpcprintf("inputreaderinformation(ID):");cscanf("%s",p0->ID);p2=h;p1=h->next;if(p1==NULL){cprintf("\r\nnoinformation\r\n");cprintf("pressanykeytoexit\r\n");break;}{whilep1){if(strcmp(p1->ID,p0->ID)==0)break;}if(!p1){cprintfrnpressEscexit\r\n2.pressanykeytocontunieshanchu\r\n");j=get_key();clrscr();if(j==Esc)break;}{cprintf("thestudentinformationhavedeleted\r\n");cprintf("\r\n1.pressEscexit\r\n2.pressanykeytocontunieshanchu\r\n");j=get_key();clrscr();if(j==Esc)break;}}}returnh;}/*删除图书*/structbook*shanchu2(structbook*h){structbook*p1,*p2,*p0,*p3;intj;{eatbookpcprintf("inputbookinformation(ID):");cscanf("%s",p0->bookID);nextif(p1==NULL){cprintf("\r\nnoinformation\r\n");cprintf("pressanykeytoexit\r\n");}{whilep1){if(strcmp(p1->bookID,p0->bookID)==0)break;}if(!p1){cprintfrnpressEscexit\r\n2.pressanykeytocontunieshanchu\r\n");j=get_key();clrscr();if(j==Esc)break;}{cprintf("thebookinformationhavedeleted\r\n");cprintf("\r\n1.pressEscexit\r\n2.pressanykeytocontunieshanchu\r\n");j=get_key();clrscr();if(j==Esc)break;}}}returnh;}/*借书与还书*/voidborrow(STD*h,structbook*h2,chark){charxuehao[10],m;STD*p;inti=1,j;structbook*p2;while(i){cprintf("inputreaderinformation(ID):");cscanf("%s",xuehao);cprintf("\r\n");p=h->next;while(p){if(strcmp(p->ID,xuehao)==0)break;p=p->next;}if(!p){cprintf("nothisreader\r\n1pressEsctoexit\r\n2.pressanykeytocontinueborrow\r\n");j=get_key();clrscr();if(j==Esc)i=0;}{hile{cprintf("inputthebookID:");cscanf("%s",xuehao);cprintf("\r\n");hilep{if(strcmp(p2->bookID,xuehao)==0)break;}if(!p2){again\r\n");j=get_key();if(j==Esc){i=0;clrscr();break;}}{if(k=='1'){if(strcmp(p2->reader,T1)!=0){cprintf("haveborrowedbyother\r\n1.pressEscexit\r\n2.pressanykeytocontunieborrow\r\n");j=get_key();if(j==Esc)i=0;clrscr();}{cprintf("borrowover\r\n");cprintf("\r\n1.pressEscexit\r\n2.pressanykeytocontunieborrow\r\n");strcpy(p2->lend,T2);strcpy(p2->reader,p->ID);j=get_key();if(j==Esc)i=0;clrscr();}}elseif(k=='2'){cprintf("returnover\r\n");cprintf("\r\n1.pressEscexit\r\n2.pressanykeytocontuniereturn\r\n");strcpy(p2->lend,T3);j=get_key();if(j==Esc)i=0;clrscr();}break;}}}}}/*二进制存盘*/kh{FILE*fw;charfname[20];STD*p,*p0;structbook*p2,*p1;cprintf("inputfilename:");cscanf("%s",&fname);cprintf("\r\n");fw=fopen(fname,"wb");if(!fw){cprintf("failed\r\npressanykeytogo\r\n");get_key();clrscr();return;}nextif(p==NULL&&p2==NULL){printf("noinformation\r\npressanykeytogo\r\n");get_key();fclose(fw);DeletSTD(p);return;}while(p!=NULL){ritepsizeofSTDfwp0=p;p=p->next;}while(p2!=NULL){}cprintf("over\r\npressanykeytogo\r\n");get_key();clrscr();}/*主函数*/voidmain(){inti=1,key,ji=0,jk=1,ot=1;char*buf;char*sTitle="LibaryMIS";char*information[]={"1.Add"2.All>",>",>",>","5.Borrow&Return>",e"7.Help","8.Exit"};char*m[]={"1.addreader","2.addbook","1.Allreader","2.Allbook","1.searchreader","2.searchbook","1.shanchureader","2.shanchubook","1.borrow","2.return"};STD*h1;structbook*h2;CreatSTD(h1);h1->next=NULL;Creatbook(h2);h2->next2=NULL;while(ot){jk=1;textbackground(WHITE);clrscr();textcolor(0);Dialog(x1,y1,w,r,sTitle,information);buf=(char*)malloc((w2+1)*3*2);xuanzhong(w,3+i,2,14,information[i-1],'1');wxyxwyr{if(key==Down){xuanzhong(w,3+i,WHITE,0,information[i-1],'1');if(i==r)i=1;xuanzhong(w,3+i,2,14,information[i-1],'1');}if(key==Up){xuanzhong(w,3+i,WHITE,0,information[i-1],'1');if(i==1)i=r;xuanzho

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论