我的程序设计基础课程设计报告(共14页).doc
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《我的程序设计基础课程设计报告(共14页).doc》由会员分享,可在线阅读,更多相关《我的程序设计基础课程设计报告(共14页).doc(14页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、精选优质文档-倾情为你奉上程序设计基础课程设计报告班 级: 通信1002班 姓 名: 段光军 指导教师: 完成日期: 2011-09-02 专心-专注-专业(题目)1 设计题目与要求设计内容:要求将输入的图书信息实现信息的删除和修改功能。2 算法设计与描述(要求有相关流程图) 2.1 算法设计与描述删除过程:利用结构体,在for循环语句的作用下对过程进行描述,过程中运用ifelse语句对图书进行删除以及对不存在的书籍的处理进行进一步的说明。修改过程:运用结构体,过程中利用for循环语句作为整体框架,并用if语句和当循环进行描述。过程中对图书的修改及修改的项目类型进行表述和不存在的图书进行处理。
2、. 2.2 流程图 3 设计软硬件环境课程设计的软硬件环境为:IBM PC兼容机,Intel P4以上、1G内存、80GB硬盘、Windows 操作系统,Trubo C+ 3.0、VC6.0以上IDE环境。4 源程序代码清单#include#include#include#include struct books_list char author20; char bookname20; char publisher20; char pbtime15; char loginnum10; float price; char classfy10; struct books_list * next;
3、; struct books_list * Create_Books_Doc(); void InsertDoc(struct books_list * head);void DeleteDoc(struct books_list * head , int num);void Print_Book_Doc(struct books_list * head);void search_book(struct books_list * head);void info_change(struct books_list * head);void save(struct books_list * head
4、); struct books_list * Create_Books_Doc() struct books_list * head; head=(struct books_list *)malloc(sizeof(struct books_list); head-next=NULL; return head; void save(struct books_list * head) struct books_list *p; FILE *fp; p=head; fp=fopen(data.txt,w+); fprintf(fp, 登录号 书 名 作 者 出版单位 出版时间 分类号 价格 n);
5、 while(p-next!= NULL) p=p-next; fprintf(fp, %-6.6s %-10.10s %-10.10s %-10.10s %-12.12s %-6.6s %.2f n,p-loginnum,p-bookname,p-author,p-publisher,p-pbtime,p-classfy,p-price); fclose(fp); printf( 已将图书数据保存到 data.txt 文件n); void InsertDoc(struct books_list *head) struct books_list *s, *p; char flag=Y; p=h
6、ead; while(p-next!= NULL) p=p-next; while(flag=Y|flag=y) s=(struct books_list *)malloc(sizeof(struct books_list); printf(n 请输入图书登陆号:); fflush(stdin); scanf(%s,s-loginnum); printf(n 请输入图书书名:); fflush(stdin); scanf(%s,s-bookname); printf(n 请输入图书作者名:); fflush(stdin); scanf(%s,s-author); printf(n 请输入图书出
7、版社:); fflush(stdin); scanf(%s,s-publisher); printf(n 请输入图书出版时间:); fflush(stdin); scanf(%s,s-pbtime); printf(n 请输入图书分类号:); fflush(stdin); scanf(%s,s-classfy); printf(n 请输入图书价格:); fflush(stdin); scanf(%f,&s-price); printf(n); p-next=s; p=s; s-next=NULL; printf( 添加成功!); printf(n 继续添加?(Y/N):); fflush(st
8、din); scanf(%c,&flag); printf(n); if(flag=N|flag=n) break; else if(flag=Y|flag=y) continue; save(head); return; void search_book(struct books_list *head) struct books_list * p; char temp20; p=head; if(head=NULL | head-next=NULL) printf( 图书库为空!n); else printf(请输入您要查找的书名: ); fflush(stdin); scanf(%s,te
9、mp); while(p-next!= NULL) p=p-next; if(strcmp(p-bookname,temp)=0) printf(n图书已找到!n); printf(n); printf(登录号: %stn,p-loginnum); printf(书名: %stn,p-bookname); printf(作者名: %stn,p-author); printf(出版单位: %stn,p-publisher); printf(出版时间: %stn,p-pbtime); printf(分类号: %stn,p-classfy); printf(价格: %.2ftn,p-price);
10、if(p-next=NULL) printf(n查询完毕!n); return; void Print_Book_Doc(struct books_list * head) struct books_list * p; if(head=NULL | head-next=NULL) printf(n 没有图书记录! nn); return; p=head; printf( 登录号 书 名 作 者 出版单位 出版时间 分类号 价格 n); while(p-next!= NULL) p=p-next; printf(%-6.6s %-10.10s %-10.10s %-10.10s %-12.12s
11、 %-6.6s %.2f n,p-loginnum,p-bookname,p-author,p-publisher,p-pbtime,p-classfy,p-price); printf(n); void info_change(struct books_list * head) struct books_list * p; int panduan=0; char temp20; p=head; printf(请输入要修改的书名:); scanf(%s,temp); while(p-next!= NULL) p=p-next; if(strcmp(p-bookname,temp)=0) pri
12、ntf(n 请输入图书登陆卡号:); fflush(stdin); scanf(%s,p-loginnum); printf(n 请输入图书书名:); fflush(stdin); scanf(%s,p-bookname); printf(n 请输入图书作者名:); fflush(stdin); scanf(%s,p-author); printf(n 请输入图书出版社:); fflush(stdin); scanf(%s,p-publisher); printf(n 请输入图书出版时间:); fflush(stdin); scanf(%s,p-pbtime); printf(n 请输入图书分
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 程序设计 基础 课程设计 报告 14
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内