ImageVerifierCode 换一换
格式:DOCX , 页数:22 ,大小:18.56KB ,
资源ID:6905407      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/6905407.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(图书管理系统c语言绝对可以用.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

图书管理系统c语言绝对可以用.docx

1、图书管理系统c语言绝对可以用#include #define booksize 100#define blhnum 50#define rrunm 50#include typedef struct int bno; char bname21; int namenext; char author9; int authnext; char press11; int prenext; char sortno4; int storenum; int borrownum; bookrectype; typedef struct bookrectype bookdbasebooksize; int le

2、n; bookdbasefile; typedef struct int bno; int recno; bidxrectype; typedef struct bidxrectype bnoidxbooksize; int len; bnoidxfile; typedef struct char bname21; int lhead; int recnum; bnrectype; typedef struct bnrectype lhfrec1blhnum; int len1; lhfile1; typedef struct char author9; int lhead; int recn

3、um; barectype; typedef struct barectype lhfrec2blhnum; int len2; lhfile2; typedef struct char press11; int lhead; int recnum; bprectype; typedef struct bprectype lhfrec3blhnum; int len3; lhfile3; typedef struct int rno; char name8; int bn1; int bn2; rrectype; typedef struct rrectype readrecrrunm; in

4、t len; readerfile; typedef struct int rno; int recno; ridxrectype; typedef struct ridxrectype rnoidxrrunm; int len; rnoidxfile; typedef struct int rno; int bno; char date19; char date29; bbookrectype; typedef struct bbookrectype bbookbooksize; int len; bbookfile;bookdbasefile appedbaserec(bookdbasef

5、ile bf) int i; i=+bf.len; printf(书号 书 名 作者名 出版商 分类号 藏书量 n); scanf(%d%s,&bf.bookdbasei.bno, bf.bookdbasei.bname); scanf(%s%s,&bf.bookdbasei.author, bf.bookdbasei.press); scanf(%s %d,&bf.bookdbasei.sortno,&bf.bookdbasei.storenum); bf.bookdbasei.borrownum=0; return bf;bnoidxfile changebnoidxf(bookdbase

6、file bf,bnoidxfile bif) int i,j,k=1; i=bf.len; j=bif.len; while(j=1) if(bf.bookdbasei.bnobif.bnoidxi.bno) k=j+1;break; j-; if(bif.len0) for(j=bif.len;j=k;j-) bif.bnoidxj+1=bif.bnoidxj; bif.bnoidxk.bno=bf.bookdbasei.bno; bif.bnoidxk.recno=i; bif.len+; return bif;lhfile1 changelinkheabf1(bookdbasefile

7、 *bf,lhfile1 lhf1) int i,j,k,m; char sm21; i=bf-len; strcpy(sm,bf-bookdbasei.bname); j=1;k=0; while(jbookdbasei.namenext=lhf1.lhfrec1k.lhead; lhf1.lhfrec1k.lhead=i; lhf1.lhfrec1k.recnum+; else m=+lhf1.len1; bf-bookdbasei.namenext=0; lhf1.lhfrec1m.lhead=i; lhf1.lhfrec1m.recnum=1; strcpy(lhf1.lhfrec1m

8、.bname,sm); return lhf1;lhfile2 changelinkheabf2(bookdbasefile *bf,lhfile2 lhf2) int i,j,k,m; char zz9; i=bf-len; strcpy(zz,bf-bookdbasei.author); j=1;k=0; while(jbookdbasei.authnext=lhf2.lhfrec2k.lhead; lhf2.lhfrec2k.lhead=i; lhf2.lhfrec2k.recnum+; else m=+lhf2.len2; bf-bookdbasei.authnext=0; lhf2.

9、lhfrec2m.lhead=i; lhf2.lhfrec2m.recnum=1; strcpy(lhf2.lhfrec2m.author,zz); return lhf2;lhfile3 changelinkheabf3(bookdbasefile *bf,lhfile3 lhf3) int i,j,k,m; char cbs11; i=bf-len; strcpy(cbs,bf-bookdbasei.press); j=1;k=0; while(jbookdbasei.prenext=lhf3.lhfrec3k.lhead; lhf3.lhfrec3k.lhead=i; lhf3.lhfr

10、ec3k.recnum+; else m=+lhf3.len3; bf-bookdbasei.prenext=0; lhf3.lhfrec3m.lhead=i; lhf3.lhfrec3m.recnum=1; strcpy(lhf3.lhfrec3m.press,cbs); return lhf3;int binsearch(bnoidxfile bif,int key) int low,high,mid; low=1; high=bif.len; while(low=high) mid=(low+high)/2; if(key=bif.bnoidxmid.bno) return bif.bn

11、oidxmid.recno; else if (keybif.bnoidxmid.bno) high=mid-1; else low=mid+1; return 0;/binsearchint bnamefind(lhfile1 lhf1,char key) int i,k=0; for(i=1;i=lhf1.len1;i+) if(strcmp(key,lhf1.lhfrec1i.bname)=0) k=lhf1.lhfrec1i.lhead;break; return k;int bauthfind(lhfile2 lhf2,char key) int i,k=0; for(i=1;i=l

12、hf2.len2;i+) if(strcmp(key,lhf2.lhfrec2i.author)=0) k=lhf2.lhfrec2i.lhead;break; return k;int bpressfind(lhfile3 lhf3,char key) int i,k=0; for(i=1;i=1 & choose=1) if(rf.readreci.rnorif.rnoidxi.rno) k=j+1;break; j-; if(rif.len0) for(j=rif.len;j=k;j-) rif.rnoidxj+1=rif.rnoidxj; rif.rnoidxk.rno=rf.read

13、reci.rno; rif.rnoidxk.recno=i; rif.len+; return rif;int rinsearch(rnoidxfile rif,int key) int low,high,mid; low=1; high=rif.len; while(low=high) mid=(low+high)/2; if(key=rif.rnoidxmid.rno) return rif.rnoidxmid.recno; else if (keyreadreck.bn2=rf-readreck.bn1) printf(书已借满!n);return; j=binsearch(bif,sh

14、); /查找图书文件 if(j=0) printf(非法书号!n);return; if(bf-bookdbasej.borrownum=bf-bookdbasej.storenum) printf(图书已借出!n);return; i=+bbf-len; /借还书记录数加1 bbf-bbooki.rno=dzh; /借还书文件追加一条记录,记录相关内容 bbf-bbooki.bno=sh; strcpy(bbf-bbooki.date1,jyrq); rf-readreck.bn2+; /读者借出数加1 bf-bookdbasej.borrownum+; /图书借出数加1 printf(借书

15、成功!n);void backbook(bookdbasefile *bf,bnoidxfile bif,bbookfile *bbf,readerfile *rf,rnoidxfile rif) char hsrq9; int sh,dzh; int i,j,k,m=0; printf(读者号 书号 还书日期 n); scanf(%d%d%s,&dzh,&sh,hsrq); k=rinsearch(rif,dzh); /查找读者文件 if(k=0) printf(非法读者!n);return; for(i=1;ilen;i+) /查询借还书文件 if(sh=bbf-bbooki.bno) m

16、=i;break; if(m=0) printf(非法书号!n);return; j=binsearch(bif,sh); /查找图书文件 if(j=0) printf(非法书号!n);return; strcpy(bbf-bbookm.date2,hsrq); /填入还书日期 rf-readreck.bn2-;/修改借书数 bf-bookdbasej.borrownum-; /修改借出数 printf(还书成功!n); void writefile(bookdbasefile bf,bnoidxfile bif,lhfile1 f1, lhfile2 f2,lhfile3 f3,reader

17、file rf,bbookfile bbf,rnoidxfile rif) FILE *fp;int i; /写图书主文件 fp=fopen(book,wb); for(i=1;i=bf.len;i+) fwrite(&bf.bookdbasei,sizeof(bookrectype),1,fp); fclose(fp); /写图书索引文件 fp=fopen(bidx,wb); for(i=1;i=bif.len;i+) fwrite(&bif.bnoidxi,sizeof(bidxrectype),1,fp); fclose(fp); /写书名索引链头文件 fp=fopen(nidx,wb)

18、; for(i=1;i=f1.len1;i+) fwrite(&f1.lhfrec1i,sizeof(bnrectype),1,fp); fclose(fp); /写作者索引链头文件 fp=fopen(aidx,wb); for(i=1;i=f2.len2;i+) fwrite(&f2.lhfrec2i,sizeof(barectype),1,fp); fclose(fp); /写出版社索引链头文件 fp=fopen(pidx,wb); for(i=1;i=f3.len3;i+) fwrite(&f3.lhfrec3i,sizeof(bprectype),1,fp); fclose(fp);

19、/写读者文件 fp=fopen(read,wb); for(i=1;i=rf.len;i+) fwrite(&rf.readreci,sizeof(rrectype),1,fp); fclose(fp); /写借还书文件 fp=fopen(bbf,wb); for(i=1;i=bbf.len;i+) fwrite(&bbf.bbooki,sizeof(bbookrectype),1,fp); fclose(fp); /写读者号文件 fp=fopen(ridx,wb); for(i=1;i=rif.len;i+) fwrite(&rif.rnoidxi,sizeof(ridxrectype),1,fp); fclose(fp); void readfile(bookdbasefile *bf,bnoidxfile *bif,lhfile1 *f1, lhfile2 *f2,lhfile3 *f3,readerfile *rf,bbookfile *bbf,rnoidxfile *rif)

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1