文档介绍:图书管理系统软件C
LT
#include<>
#include<>
#include<>
#include<>
#define PRINT1 printf("********************************************************\n")
#define PRINT2 printf("图书编号-图书名称-图书作者-图书类型-图书出版社-图书出版时间(年-月-日)-图书数量\n")
#define PRINT3 printf(" %d %s %s %s %s %d-%d-%d %d\n",book[i].num, book[i].name,book[i].writer,book[i].type,book[i].publish,book[i].,book[i].,book[i].,book[i].amount)
#define PAGE 3
#define MAX 300
int sum; /*用来记录图书数目(全局变量)*/
struct DATE/*定义日期结构体类型*/
{ int year;
int month;
int day;
};
struct BOOK/*定义图书结构体类型*/
{ int num; /*图书编号*/
char name[10]; /*图书名称*/
char writer[8]; /*图书作者*/
char type[10]; /*图书类型*/
char publish[40]; /*图书出版社*/
struct DATE publish_time; /*图书出版时间*/
int amount; /*图书数量*/
}book[MAX];/*存放MAX个图书信息记录的结构体数组*/
/*录入模块*/
void input()
{
int i=0,s=MAX;
char choice;
printf("\n\n **** 录入图书信息**** (最多%d种)\n",s);
printf("
{
FILE *fp;
int i=0;
char filename[10];
printf("\n 输入要保存的文件名称:");
scanf("%s",filename); /*交互式文件方法*/
if ( (fp=fopen(filename, "wb")) == NULL)
{
printf("\n\n****写文件错误!****\n\n");
}
if(fwrite(&book[i],sizeof(book[MAX]),1,fp)!=1)
printf("****写文件错误!****\n");
fclose(fp);
}
/*读取模块*/
void read()
{
FILE *fp;
int i=0;
char filename[10];
printf("\n 输入要保存的文件名称:");
scanf("%s",filename); /*交互式文件方法*/
if ( (fp=fopen(filename, "r")) == NULL)
{
printf("\n\n****读文件错误!****\n\n");
}
while(!feof(fp))
{
fread(&book[i],sizeof(book[MAX]),1,fp);
if(book[i].num==0)
break;
else
i++;
}
fclose(fp);
sum=i;
}
/*