图书管理分类统计c语言,C语言实现图书管理系统

本文实例为大家分享了C语言实现图书管理系统的具体代码,供大家参考,具体内容如下

一、分析过程

首先此程序需要实现输入、增加、删除、查询、输出的五大功能,则首先需要设置一个菜单键,让用户可以选择不同的功能,完成不同的操作,然后编写不同的函数实现不同的功能,在这个过程中注意要人性化,让用户方便,直观的进行操作。

二、算法

三、函数模块介绍

1录入模块:本模块主要执行信息的录入功能

2浏览模块:本模块主要是执行把已有信息输出浏览功能

3查询模块:本模块主要是按照图书名查找图书的相关信息

4删除模块:主要是执行删除图书信息的功能

5退出模块:方便用户离开

四、源程序

#include

#include

#include

#include

struct books_list

{

char author[20]; /*作者名*/

char bookname[20]; /*书名*/

char publisher[20]; /*出版单位*/

char pbtime[15]; /*出版时间*/

char loginnum[10]; /*登陆号*/

float price; /*价格*/

char classfy[10]; /*分类号*/

struct books_list * next; /*链表的指针域*/

};

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 save(struct books_list * head);/*保存数据至文件*/

/*新建链表头节点*/

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+"); /*以写方式新建并打开 data.txt文件*/

fprintf(fp,"┏━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━━┳━━━┳━━━━┓\n"); /*向文件输出表格*/

fprintf(fp,"┃登录号┃ 书 名 ┃ 作 者┃ 出版单位 ┃ 出版时间 ┃分类号┃ 价格 ┃\n");

你可能感兴趣的:(图书管理分类统计c语言)