小型图书信息管理系统(C语言)_第1页
小型图书信息管理系统(C语言)_第2页
小型图书信息管理系统(C语言)_第3页
小型图书信息管理系统(C语言)_第4页
小型图书信息管理系统(C语言)_第5页
已阅读5页,还剩5页未读 继续免费阅读

下载本文档

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

文档简介

1 题目题目 小型图书信息管理系统 的设计与实现 2 功能功能 1 每一条记录包括一本图书的书名 ISBN 作者 出版社 定价 出版日期和数量 2 输入功能 可以一次完成无数条记录的输入 3 显示功能 完成全部图书信息的显示 4 查找功能 完成按书名查找图书信息 并显示 5 排序功能 按图书价格进行排序 6 插入功能 按图书价格高低插入一条图书信息 7 保存功能 将图书信息保存在任何自定义的文件中 如保存在 c book 8 读取功能 将保存在文件中的图书信息读取出来 9 有一个清晰美观界面来调用各个功能 3 要求要求 1 整个系统均用C语言实现 2 利用指针 链表来实现学生成绩的数据结构设计 3 系统具有输入 显示 查询 删除 排序 插入 保存 读取基本功能 4 系统的各个功能模块都用函数的形式来实现 5 可以将图书信息保存在文件中 6 可以将图书信息从文件中读取出来 4 源程序源程序 include include include include include define LL sizeof BOOK TYPE int maininterface void infor input void refer void refer 1 void refer 2 void modify void delete void findbook void findbook1 void findbook2 void devise void main int a 0 do a maininterface switch a case 1 system CLS infor input break case 2 system CLS refer break case 3 system CLS modify break case 4 system CLS delete break case 5 exit 0 default system CLS printf n n n n t t t 无此操作 请按任意键返回 n getch system CLS while a 6 int maininterface int n printf n n n t t 小型图书登记管理系统 n printf n t t t t1 n printf n t t t t2 n printf n t t t t3 n printf n t t t t4 n printf n t t t t5 n printf n t t t 请输入 1 5 其他输入非法 n scanf d return n typedef struct int month int day int year DATES DATES day typedef struct books char bookname 50 char ISBN 50 char author 50 char publisher 50 float money DATES day int count struct books next BOOK TYPE BOOK TYPE ts struct books head NULL void infor input FILE fp int n 0 BOOK TYPE ts printf 图书资料基本信息录入 n do printf 请输入书名 n scanf s ts bookname printf 请输入 ISBN n scanf s ts ISBN printf 请输入作者 n scanf s ts author printf 请输入出版社 n scanf s ts publisher printf 请输入定价 n scanf f printf 请输入出版日期 n scanf d d d printf 请输入数量 n scanf d printf n t t t 请选择 1 确定 t2 取消 t0 重新输入 scanf d while n 0 if n 1 if fp fopen book txt a NULL 若 book txt 文件不存在 则以创建方式 打开文件 fp fopen book txt w fwrite 将输入的图书信息写入磁盘文件 book txt fclose fp system CLS printf 输入成功 n printf 请选择 1 返回主界面 t2 输入另一本图书信息 t0 退出系统 n scanf d switch n case 1 system CLS break case 2 system CLS infor input break case 0 break default printf 无此操作 按任意键返回 n getch system CLS break void refer int n printf 1 n printf 2 n printf 3 n printf 4 n printf 5 n printf 0 n printf 请输入 0 5 其他输入非法 n scanf d switch n case 1 system CLS findbook break case 2 system CLS findbook1 break case 3 system CLS findbook2 break case 4 system CLS refer 1 break case 5 system CLS refer 2 break case 0 system CLS break default printf 无此操作 n break struct books read 1 FILE fp struct books p1 p2 head fp fopen book txt r head p1 BOOK TYPE malloc LL fread p1 LL 1 fp while feof fp 0 p2 BOOK TYPE malloc LL fread p2 LL 1 fp p1 next p2 p1 p2 p1 next NULL fclose fp return head void refer 1 struct books head p d struct books read 1 int total 0 head read 1 for p head p next NULL d p p p next free d total total p count printf 书籍总数 d n total printf 按任意键返回 getch system CLS void refer 2 int num 0 struct books head p1 p2 struct books read 1 float total 0 average 0 head read 1 for p1 head p1 next NULL p2 p1 p1 p1 next free p2 num num p1 count total total p1 money p1 count average total num printf 书籍总金额 2f n total printf 书籍平均价格 2f n average printf 按任意键返回 getch system CLS void findbook FILE fp char ISBN 50 int i fp fopen book txt r printf 请输入书的 ISBN 号 n scanf s ISBN for i 0 fread i if strcmp ISBN ts ISBN 0 printf 这本书的详细资料为 s s s s f d d d d n 按任意键返回 n ts bookname ts ISBN ts author ts publisher ts money ts day month ts day day ts day year ts cou nt printf 没有你所需要的书籍 fclose fp void findbook1 FILE fp char publisher 50 int i fp fopen book txt r printf 请输入书的 publisher n scanf s publisher for i 0 fread i if strcmp publisher ts publisher 0 printf 这本书的详细资料为 s s s s f d d d d n 按任意键返回 n ts bookname ts ISBN ts author ts publisher ts money ts day month ts day day ts day year ts cou nt printf 没有你所需要的书籍 fclose fp void findbook2 FILE fp char bookname 50 int i fp fopen book txt r printf 请输入书的 bookname n scanf s bookname for i 0 fread i if strcmp bookname ts bookname 0 printf 这本书的详细资料为 s s s s f d d d d n 按任意键返回 n ts bookname ts ISBN ts author ts publisher ts money ts day month ts day day ts day year ts cou nt printf 没有你所需要的书籍 fclose fp void delete struct books p1 p2 char ISBN 50 int e 0 if head NULL printf 无书籍记录 return printf 请输入您要删除的书籍的 ISBN n scanf s ISBN p1 head while ISBN p1 ISBN p1 p1 next if ISBN p1 ISBN if p1 head head p1 next else p2 next p1 next free p1 e else printf 没有该书籍记录 请核对 n void modify struct books p1 p2 char ISBN 50 if head NULL printf 无书籍记录 n return printf 请输入您要修改的书籍的 ISBN n scanf s ISBN p1 head while ISBN p1 ISBN p1 p1 next if ISBN p1 ISBN devise p1 else printf 没有该学生记录 请核对 n void devise struct books p int choice choice 1 do printf 请选择您要修改的书籍的信息内容 n printf n printf 书名 请按 1 n printf ISBN 请按 2 n printf 作者 请按 3 n printf 出版社请按 4 n printf 定价 请按 5 n printf 出版日期 请按 6 n printf 数量 请按 7 n printf 取消 请按 0 n printf n printf 请输入您的选择 scanf d switch choice case 0 return case 1 printf 请输入新书名 scanf s p bookname break case 2 printf 请输入新 ISBN scanf s break case 3 printf 请输入新作者 scanf s p author break case 4 printf 请输入新出版社 scanf s p publisher break case 5 printf 请输入新定价 scanf d p money break case 6 printf 请输入新出版日期 scanf ld break case 7 printf 请输入新数量 scanf s p count break default printf n 无效选项 break while choice 0 经过一个多星期的 C 语言课程设计 感觉自己收获不少 首先是 链表本来上课是没有上的 但这个课程设计里面主要都是用链表 因为要达 到这样的功能 使用链表相当方便 但不容易理解 所以在这方面我很了很多的时间看课 本和参考课外书 使 C 语言的知识

温馨提示

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

最新文档

评论

0/150

提交评论