课程设计.docx

上传人:b****5 文档编号:4103502 上传时间:2022-11-27 格式:DOCX 页数:24 大小:91.66KB
下载 相关 举报
课程设计.docx_第1页
第1页 / 共24页
课程设计.docx_第2页
第2页 / 共24页
课程设计.docx_第3页
第3页 / 共24页
课程设计.docx_第4页
第4页 / 共24页
课程设计.docx_第5页
第5页 / 共24页
点击查看更多>>
下载资源
资源描述

课程设计.docx

《课程设计.docx》由会员分享,可在线阅读,更多相关《课程设计.docx(24页珍藏版)》请在冰豆网上搜索。

课程设计.docx

课程设计

存档资料成绩:

 

华东交通大学理工学院

课程设计报告书

 

所属课程名称《C语言程序设计》课程设计

题目  图书馆信息管理系统           

   

分院  电信分院   

专业班级电气3班

学  号20130210470335     

学生姓名 郑毓豪       

指导教师葛   

 

20年月日

序号

项目

等   级

优秀

良好

中等

及格

不及格

1

课程设计态度评价

2

出勤情况评价

3

任务难度评价

4

工作量饱满评价

5

任务难度评价

6

设计中创新性评价

7

论文书写规范化评价

8

综合应用能力评价

综合评定等级

课程设计(论文)评阅意见

 

评阅人 职称

20年月日

目 录

第1章课程设计内容及要求.......................3

第2章设计的过程及步骤..........................6

第3章设计成果展示..............................10

第4章程序代码..................................13

第5章课程设计心得体会..........................47

第6章参考文献..................................48

第一章课程设计内容及要求

(对问题背景及主要实现的功能进行简要说明。

随着图书馆图书的不断增加,图书管理的难度也随之加大,一个好的图书馆图书信息管理系统,能够使图书管理工作简便,有条不紊。

通过C语言学习,我们已经能够完成基本的C语言编程,此次实训,是将学习和实践结合,充分感受C语言解决实践问题的魅力。

此次编写的图书馆信息管理系统,能够实现基本的图书管理功能。

它包括图书库的创建,打印图书信息表,录入新图书,修改图书信息,删除图书信息,借书,还书。

图书库包含图书的各方面信息,编号,类型,作者,出版社,总数,剩余量等等,并且打印图书信息表。

录入,修改,删除这些功能都是对图书库的操作。

借书,还书这两项最重要的功能也都能很好的实现。

把此系统应用于图书馆的图书管理,能使图书馆的各项工作便捷,可靠的完成。

系统要求

(主要是对系统技术目标和要求)

欢迎界面、主菜单、系统管理功能、图书信息管理、借阅功能模块、

其中系统管理功能包括系统管理员添加、删除、修改信息以及用管理员身份登录系统等功能。

图书信息管理包括新增图书、修改图书、删除图书、等功能。

借阅功能模块包括借书功能、还书功能、查询已借图书、查询过期未还图书,其中借书还书功能可以按图书编号信息进行操作。

 

第二章设计的过程及步骤

1、需求分析

(描述系统需求,既详细分析系统需求和功能)

根据题目要求,应当把图书信息用结构体形式输入,再定义一个全局变量和文件指针进行整个程序的运行,然后把图书信息送到文件中,所以应该提供一个结构体和文件的输入输出等操作;在程序中需实现图书信息录入,浏览,查询,删除和修改等功能的操作,所以需要建立相应的模块来实现;另外还需提供键盘式选择菜单实现功能,在运行时达到所要目的。

2、设计文件结构

(设计文件结构,并扼要说明设计缘由)

此系统根据所要实现的功能,使用的函数等综合考虑,设计了两个,图书信息文件(tushu.red),借还书文件(borrow.red),录入新图书,修改,删除图书等一些操作时在图书信息文件上运行,借还书功能则在借还书文件上运行,同时也要在图书信息文件上运行。

两个文件相互结合,使各个功能很好的实现了,运用C语言的文件功能,也是整个程序的主线。

3、设计系统功能图

(根据需求分析结果和文件结构,应用结构化分析与设计技术设计功能结构图,如下图所示)

 

4、函数设计

(详细分析每一个子模块的子功能,定义主要的子函数原型,并对每一个函数的功能加以说明)

此系统主要有7个功能,也就有主要的7个函数,他们分别是

voidshan()//删除图书信息

voidxiu()//修改图书信息

voidputin()//录入新图书

voidprint()//打印图书信息表

voidreturned()//还书

voidbooks()//创建图书文件

voidborrowed()//借书

其中每一个函数都用到了两个结构体,它们分别是:

structtushu

{

charbianhao1[10];

charbianhao2[10];

charleixing[20];

charshuming[50];

charchubanshe[50];

charwriter[20];

longzongshu;

longshengyu;

}shu;

structbooks

{

charbianhao1[10];

charbianhao2[10];

longnian;

longborrowmonth;

longborrowday;

longreturnedmonth;

longreturnedday;

longlimittime;

charstudent[10];

}book;

 

第三章课程设计成果

(对自己的最后的实验成果进行概括)

经过长达9天的编写,修改,运行,最后完成时,预想的功能都能比较好的实现。

下面是各个功能运行的界面:

进入界面:

功能选择界面:

 

录入新图书界面:

还有各个功能各种界面,这里就不一一列出了。

 

第四章程序代码

#include

#include

#include

structtushu

{

charbianhao1[10];

charbianhao2[10];

charleixing[20];

charshuming[50];

charchubanshe[50];

charwriter[20];

longzongshu;

longshengyu;

}shu;

structbooks

{

charbianhao1[10];

charbianhao2[10];

longnian;

longborrowmonth;

longborrowday;

longreturnedmonth;

longreturnedday;

longlimittime;

charstudent[10];

}book;

voidshan()//删除图书信息

{

FILE*fp;

inti=0,j,n,m,l;

charbooknum[20];

structtushutu[1000];

if((fp=fopen("tushu.txt","r"))==NULL)

{

printf("cannotopenthetushu.txt.\n");

exit(0);

}

while(fread(&tu[i],sizeof(shu),1,fp))

{

i++;

m=i;

}

printf("要删除几本书:

");

scanf("%d",&n);

getchar();

for(i=0;i

{

printf("输入图书编号2:

");

gets(booknum);

for(j=0;j

if(strcmp(booknum,tu[j].bianhao2)==0)

break;

if(j

{

for(l=0;l

if(strcmp(tu[j].bianhao1,tu[l].bianhao1)==0)

{

tu[l].zongshu--;

tu[l].shengyu--;

}

for(j;j

tu[j]=tu[j+1];

}

else

{

printf("输入有误重新输入\n");

i--;

}

}

if((fp=fopen("tushu.txt","w"))==NULL)

{

printf("cannotopenthetushu.txt.\n");

exit(0);

}

for(i=0;i

fwrite(&tu[i],sizeof(shu),1,fp);

printf("删除成功!

");

}

voidxiu()//修改图书信息

{

FILE*fp;

inti=0,m,n;

charbooknum[20],numchar[20];

structtushutu[1000];

if((fp=fopen("tushu.txt","r"))==NULL)

{

printf("cannotopentheborrow.txt.\n");

exit(0);

}

while(fread(&tu[i],sizeof(shu),1,fp))

{

i++;

m=i;

}

if((fp=fopen("tushu.txt","w"))==NULL)

{

printf("cannotopentheborrow.txt.\n");

exit(0);

}

printf("要修改几本书:

");

scanf("%d",&n);

getchar();

for(i=0;i

{

printf("输入要修改的图书编号2:

");

gets(booknum);

for(i=0;i

{

if(strcmp(booknum,tu[i].bianhao2)==0)

break;

}

if(i

{

printf("》》》输入修改后的\n\n");

printf("》》》输入编号1:

");

gets(tu[i].bianhao1);

printf("\n");

printf("》》》编号2:

");

gets(tu[i].bianhao2);

printf("\n");

printf("》》》类型:

");

gets(tu[i].leixing);

printf("\n");

printf("》》》书名:

");

gets(tu[i].shuming);

printf("\n");

printf("》》》出版社:

");

gets(tu[i].chubanshe);

printf("\n");

printf("》》》作者:

");

gets(tu[i].writer);

printf("\n");

printf("》》》总数:

");

gets(numchar);

printf("\n");

tu[i].zongshu=atol(numchar);

printf("》》》剩余:

");

gets(numchar);

printf("\n");

tu[i].shengyu=atol(numchar);

}

else

printf("输入有误\n");

for(i=0;i

fwrite(&tu[i],sizeof(shu),1,fp);

}

fclose(fp);

}

voidputin()//录入新图书

{

charnumchar[20];

FILE*fp;

inti=0,m,n;

structtushutu[1000];

if((fp=fopen("tushu.txt","r"))==NULL)

{

printf("cannotopentheborrow.txt.\n");

exit(0);

}

while(fread(&tu[i],sizeof(shu),1,fp))

{

i++;

m=i;

}

if((fp=fopen("tushu.txt","w"))==NULL)

{

printf("cannotopentheborrow.txt.\n");

exit(0);

}

for(i=0;i

{

fwrite(&tu[i],sizeof(shu),1,fp);

}

printf("要录入几本书:

");

scanf("%d",&n);

getchar();

for(i=0;i

{

printf("\n");

printf("》》》输入编号1:

");

gets(shu.bianhao1);

printf("\n");

printf("》》》编号2:

");

gets(shu.bianhao2);

printf("\n");

printf("》》》类型:

");

gets(shu.leixing);

printf("\n");

printf("》》》书名:

");

gets(shu.shuming);

printf("\n");

printf("》》》出版社:

");

gets(shu.chubanshe);

printf("\n");

printf("》》》作者:

");

gets(shu.writer);

printf("\n");

printf("》》》总数:

");

gets(numchar);

printf("\n");

shu.zongshu=atol(numchar);

printf("》》》剩余:

");

gets(numchar);

printf("\n");

shu.shengyu=atol(numchar);

fwrite(&shu,sizeof(shu),1,fp);

}

fclose(fp);

}

voidprint()//打印图书信息表

{

FILE*fp;

if((fp=fopen("tushu.txt","r"))==NULL)

{

printf("cannotopenthetushu.txt.\n");

exit(0);

}

puts("_______________________________________________________________________");

puts("-----------------------------------------------------------------------");

puts("|编号1|编号2|类型|书名|作者|出版社|总数|剩余|");

fseek(fp,0L,SEEK_SET);

while(fread(&shu,sizeof(shu),1,fp)==1)

printf("%-9s%-10s%-10s%-10s%-10s%-10s%-10ld%-10ld\n",shu.bianhao1,shu.bianhao2,shu.leixing,shu.shuming,shu.writer,shu.chubanshe,shu.zongshu,shu.shengyu);

}

voidreturned()//还书

{

FILE*fp;

inti=0,m,flag=0,j;

charbooknum[20];

structbooksbook1[1000];

if((fp=fopen("borrow.txt","r"))==NULL)

{

printf("cannotopentheborrow.txt.\n");

exit(0);

}

while(fread(&book1[i],sizeof(book),1,fp))

{

i++;

m=i;

}

if((fp=fopen("borrow.txt","w"))==NULL)

{

printf("cannotopentheborrow.txt.\n");

exit(0);

}

printf("输入要还的图书编号2:

");

gets(booknum);

for(j=0;j

{

if(strcmp(booknum,book1[j].bianhao2)==0)

{

flag=1;

break;

}

}

if(flag)

{

flag=0;

printf("输入还书月份:

");

scanf("%ld",&book1[i].returnedmonth);

printf("输入还书日期:

");

scanf("%ld",&book1[i].returnedday);

getchar();

for(j=0;j

fwrite(&book1[i],sizeof(book),1,fp);

}

else

printf("输入有误\n");

fclose(fp);

}

voidbooks()//创建图书文件

{

FILE*fp;

charnumchar[50],ch='y';

if((fp=fopen("tushu.txt","wt"))==NULL)

{

printf("cannotopenthetushu.txt.\n");

exit(0);

}

while(ch=='y'||ch=='Y')

{

printf("\n");

printf("》》》输入编号1:

");

gets(shu.bianhao1);

printf("\n");

printf("》》》编号2:

");

gets(shu.bianhao2);

printf("\n");

printf("》》》类型:

");

gets(shu.leixing);

printf("\n");

printf("》》》书名:

");

gets(shu.shuming);

printf("\n");

printf("》》》出版社:

");

gets(shu.chubanshe);

printf("\n");

printf("》》》作者:

");

gets(shu.writer);

printf("\n");

printf("》》》总数:

");

gets(numchar);

printf("\n");

shu.zongshu=atol(numchar);

printf("》》》剩余:

");

gets(numchar);

printf("\n");

shu.shengyu=atol(numchar);

fwrite(&shu,sizeof(shu),1,fp);

do{

printf("haveanotherbookrecord(y/n)?

:

");

gets(numchar);

ch=numchar[0];

}while(!

(ch=='y'||ch=='n'||ch=='Y'||ch=='N'));

}

fclose(fp);

}

voidborrowed()//借书

{

structtushutu[1000];

structbooksbook1[1000];

FILE*fp,*fq;

charnumchar[50];

inti=0,j,m1,m2,n,flag=0,x;

printf("借几本书:

");

scanf("%d",&x);

getchar();

if((fq=fopen("tushu.txt","r"))==NULL)

{

printf("cannotopenthetushu.txt.\n");

exit(0);

}

while(fread(&tu[i],sizeof(shu),1,fq))

{

i++;

m1=i;

}

if((fp=fopen("borrow.txt","r"))==NULL)

{

printf("cannotopentheborrow.txt.\n");

exit(0);

}

while(fread(&book1[i],sizeof(book),1,fp))

{

i++;

m2=i;

}

for(i=0;i

{

printf("\n");

printf("输入编号2:

");

gets(numchar);

for(j=0;j

{

if(strcmp(numchar,tu[j].bianhao2)==0)

{

n=j;

flag=1;

break;

}

}

if(flag)

{

printf("\n");

printf("输入正确\n\n");

flag=0;

strcpy(book.bianhao2,numchar);

printf("》》》输入编号1");gets(book.bianhao1);printf("\n");

printf("》》》借书年份:

");gets(numchar);printf("\n");book.nian=atol(numchar);

printf("》》》借书月份:

");gets(numchar);printf("\n");book.borrowmonth=atol(numchar);

printf("》》》借书日期:

");gets(numchar);printf("\n");book.borrowday=atol(numchar);

printf("》》》还书月份:

");gets(numchar);printf("\n");book.returnedmonth=atol(numchar);

printf("》》》还书日期:

");gets(numchar);printf("\n");book.returnedday=atol(numchar);

printf("》》》期限:

");gets(numchar);printf("\n");book.limittime=atol(numchar);

printf("》》》学生学号:

");gets(book.st

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 初中教育 > 学科竞赛

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

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