我的程序设计基础课程设计报告

上传人:206****923 文档编号:90422480 上传时间:2019-06-12 格式:DOC 页数:14 大小:163.01KB
返回 下载 相关 举报
我的程序设计基础课程设计报告_第1页
第1页 / 共14页
我的程序设计基础课程设计报告_第2页
第2页 / 共14页
我的程序设计基础课程设计报告_第3页
第3页 / 共14页
我的程序设计基础课程设计报告_第4页
第4页 / 共14页
我的程序设计基础课程设计报告_第5页
第5页 / 共14页
点击查看更多>>
资源描述

《我的程序设计基础课程设计报告》由会员分享,可在线阅读,更多相关《我的程序设计基础课程设计报告(14页珍藏版)》请在金锄头文库上搜索。

1、程序设计基础课程设计报告班 级: 通信1002班 姓 名: 段光军 指导教师: 完成日期: 2011-09-02 (题目)1 设计题目与要求设计内容:要求将输入的图书信息实现信息的删除和修改功能。2 算法设计与描述(要求有相关流程图) 2.1 算法设计与描述删除过程:利用结构体,在for循环语句的作用下对过程进行描述,过程中运用ifelse语句对图书进行删除以及对不存在的书籍的处理进行进一步的说明。修改过程:运用结构体,过程中利用for循环语句作为整体框架,并用if语句和当循环进行描述。过程中对图书的修改及修改的项目类型进行表述和不存在的图书进行处理。. 2.2 流程图 3 设计软硬件环境课程

2、设计的软硬件环境为: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; ; struct books_list *

3、 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); struct books_list

4、* 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); while(p-next!= NULL)

5、 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=head; while(p-next!= N

6、ULL) 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 请输入图书出版社:); fflush(stdin);

7、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(stdin); scanf(%c,&flag)

8、; 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,temp); while(p-next!= N

9、ULL) 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); if(p-next=NULL) print

10、f(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 %-6.6s %.2f n,p-logi

11、nnum,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) printf(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); sc

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 中学教育 > 其它中学文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号