#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include <conio.h>
#define N 1000//定义结构体最大长度
struct book{
char name[60];//书名
char num[20];//图书编号
double price;//书籍价格
char Head[100];
}bk[150];
int n=0;//全局变量 ,记录图书数量
void write();
void write1();
//读出文件内容
void read()
{
FILE*fp;
if ((fp=fopen("book.txt","r"))==NULL)
{
printf("file open error!\n");
exit(0);
}
else
{
fscanf(fp,"%s",&bk[1].Head);
fscanf(fp,"%s %s %s",&bk[2].Head,&bk[3].Head,&bk[4].Head);
while(!feof(fp))
{
fscanf(fp,"%s %s %lf",bk[n].num,bk[n].name,&bk[n].price);
n++;
}
}
fclose(fp);
printf("读取成功!");
}
void Show()//显示文件内容
{
int i=0;
if(n==0)
{
printf("无记录\n");
}
else
{
printf("%s\n%s\t\t\t%s\t\t\t%s\n",bk[1