图书馆管理系统论文及源代码(C语言)_第1页
图书馆管理系统论文及源代码(C语言)_第2页
图书馆管理系统论文及源代码(C语言)_第3页
图书馆管理系统论文及源代码(C语言)_第4页
图书馆管理系统论文及源代码(C语言)_第5页
已阅读5页,还剩15页未读 继续免费阅读

下载本文档

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

文档简介

1、课程设计论文一、论文题目: “程序设计方法课程设计”论文二、引言C语言作为面向结构的高级程序设计语言,有着强大的编程功能。它具有语言简洁、紧凑、方便、灵活等特点。而且,C语言运算符和数据结构丰富语法自由度大,是一种强大的程序编辑工具,适用范围很大。图书馆管理系统与学生的日常学习和生活有着密切的关系。本次试验课题“设计图书馆管理系统”充分的发挥了C语言的功能特点,很好的锻炼了学生学习应用C语言的能力,这对今后从事软件开发、研究和应用都有很大的帮助。三、论文内容:设计一个图书馆的图书管理,具体要求如下:1录入新采购的图书信息,做成文件book.in,要求有良好的输入界面;2查询各种图书的基本信息,

2、设计出良好的查询界面;3按图书编号进行排序,将排好序的图书信息输出到文件 book.out中。4统计各类图书册数、图书馆的图书总册数。5统计图书的借阅情况。四、正文1、需求分析 (1)能进行简单的图书馆管理功能操作。(2)通过图书馆信息界面进入管理系统。(3)在管理系统中完成图书的录入、查找、借阅、统计等功能。(4)得到及时的信息引导和错误提示。退出系统借阅是否借阅这本书?2、需求框图继续退出系统是否继续录入?查询结果图书馆管理系统统计每种书的个数返回图书馆信息系统按作者查询按书名查询按书号查询录入作者录入数量录入书名图书统计图书查询系统图书录入系统返回信息系统主菜单退出图书馆管理系统进入图书

3、馆信息系统录入书号3、设计分析 (1)定义book结构体,用来储存图书的信息(包括书号、书名、作者、数量)。(2)设计图书馆信息界面和图书查询界面,定义两个对应的函数用来调用这两个界面。(3)将录入的新书的内容写进文件bookin中。(4)从文件bookin中读出图书的信息(读到tnum、tname、tauther、tamount中),并与查询时输入的数据信息(ttnum、ttname、ttauther)进行比较,当有一项相同时打印处该图书信息(tnum、tname、tauther、tamount)。(5)当选择借阅当前图书时(选Y)时,tamount减一。4、设计框图Welcome to l

4、ibruary systerm tsgxx()system(cls)informationmenu()Informationtable exitbookin() choose 2checktablePlease add a book check()Add the books num name auther amountCheck by num or name or auther Ywill you borrow it?exitcountinue Yborrowedexit5、系统设计第二层分系统3:统计系统第二层分系统2:图书查询系统第二层分系统1:图书录入系统第一分层系统:图书馆信息系统退出

5、主系统:图书馆管理系统第三层分系统:图书借阅系统6、主要数据结构(1)结构体:用来储存图书信息。(2)文件:用来存储录入图书的信息。(3)数组:用来存储字符串。(4)函数:通过调用实现要求的特定功能。7、程序代码(主要程序段)#include "stdio.h"#include "stdlib.h"#include "conio.h"#include "string.h"#include "math.h"struct book int num10; char name10; char autho

6、r10; int amount4; ;*定义图书的结构体*void tsgxx();void jieshuxt();void informationmenu();void checkmenu();void mainmenu()*声明用到的一些函数* system("cls");printf("*n"); printf("Welcome to the libeary systerm!nn"); printf("tt 1.Informatin system of the librarynn"); printf(&quo

7、t;tt 2.Exit of the library systemnn");printf("*n");printf("Choose the key:");return; *打印图书馆管理系统界面*void informationtable() system("cls"); printf("Welcone to informatin system n"); printf("-n"); printf("tt1.Bookinn"); printf("tt2.ch

8、eckn"); printf("tt3.Recordn"); printf("tt4.Retern to the mainmenun"); printf("-n"); *图书信息系统界面* void checktable()system("cls"); printf("welcome to borrow systemn"); printf("-n"); printf("tt1.booknumn"); printf("tt2.bookna

9、men"); printf("tt3.bookauthern"); printf("tt4.Retern to the informationmenun"); printf("-n"); *图书查询系统界面*void main1() char choose; mainmenu(); scanf("%c",&choose); switch(choose) case '1':tsgxx();break;case '2':system ("cls");

10、printf("nnnnnnnnnttt Byebye."); getch(); exit(0);*定义mian1函数*void tsgxx() char choose; informationmenu();*定义tsgxx函数*void bookin();void checkbook();void check();void tj();main()main1();getch();*主函数*void informationmenu() char choose; informationtable(); printf("Please enter a choice! :&

11、quot;); scanf("%c",&choose); switch(choose) case '1':bookin();break; case '2':checkbook();break; case '3':tj();break; case '4':mainmenu(); *定义informationmenu函数*void checkbook()char choose; checkmenu();*定义checkbook函数*void checkmenu()char choose; checktabl

12、e(); check();*定义checkmenu函数*void bookin()char num110; char name120; char author110; char ch; int amount14; struct book temp; FILE *fp; printf("nnWelcome to add a book!"); /*if(fp)=NULL) printf("THE FILE DOSEN'T EXIST!"); fp=fopen("C:bookin.txt","w"); fclos

13、e(fp);*/ fp=fopen("C:bookin","w+"); ch='y' do printf("nnInput the new book:include( number; bookname; author; amount; )nn"); scanf("%s%s%s%s",num1,name1,author1,amount1);fprintf(fp,"%s %s %s %s",temp.num,,temp.author,temp.amount); pr

14、intf("Enter 'y' key to continue to add"); ch=getch(); while(ch='y'); fclose(fp); printf("nSave successfully!n");printf("");*定义bookin函数*int tjzs() FILE *fp; int tnum=0,tamount=0,n; char tname20='0',tauthor20='0' fp=fopen("C:bookin&quo

15、t;,"rb"); for (n=0;!feof(fp);n+) fscanf(fp,"%s %s %s %s",&tnum,tname,tauthor,&tamount); n-; fclose(fp); return (n);*定义tjzs函数*void check()FILE *fp; char choose; int tnum=0,ttnum=0,tamount=0,k,i,l,c; char tname20='0', ttname20='0',tauthor20='0',ttaut

16、hor20='0' if (fp=fopen("C:bookin","rb")=NULL) printf("nnnnnnnnntttfile not found!.any key to return."); getch(); informationtable(); l=tjzs(); checktable(); scanf("%c",&choose); if (choose='4') informationtable(); else if (choose='1'

17、;) system ("cls"); printf("enter the book number:"); scanf("%s",ttnum); elseif (choose='2') system ("cls"); printf("enter the book name:"); scanf("%s",ttname); else if (choose='3') system ("cls"); printf("ente

18、r the book auther:"); scanf("%s",ttauthor); system ("cls"); for (i=0;i<l;i+) fscanf(fp,"%s%s%s%s",tnum,tname,tauthor,tamount);k=(!strcmp(ttnum,tnum)|!strcmp(ttname,tname)|!strcmp(ttauthor,tauthor);if(k!=0) printf("ttttsearch result:nn"); printf("t

19、booknumttbooknametbookauthertbookamount n"); printf("t%stt%stt%stt%sn",tnum,tname,tauthor,tamount);printf("nttWill you borrow this book?(YorN)nn");scanf("%c",c);if (c='Y')tamount-;printf("ttThe amount now ist%s",tamount); if (k=0) system ("cl

20、s"); printf("nnnnnnntttt no one match !n"); getch(); tsgxx(); fclose(fp);getch(); tsgxx();*定义check函数*void tj()char tname20='0', ttname20='0'FILE *fp;if (fp=fopen("C:bookin","rb")=NULL) printf("nnnnnnnnntttfile not found!.any key to return."

21、;); getch(); informationtable();system ("cls"); printf("enter the book name:"); scanf("%s",ttname)l=tjzs();for (i=0;i<l;i+) fscanf(fp,"%s%s%s%s",tnum,tname,tauthor,tamount);k=(!strcmp(ttname,tname);if(k!=0)printf("ttttsearch result:nn"); printf("ttbooknamettamount);printf

温馨提示

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

评论

0/150

提交评论