求教大神????
这是一个图书录入程序 将其录入到book.txt文件中 编译连接都没有问题 就是运行到一半出问题 求大神修改 谢谢!!!#include "stdio.h"
#include "string.h"
#include "stdlib.h"
#define N 100
struct bookinf
{
char name[20];
int price1;
int price2;
char author[20];
int year;
int month;
int day;
char number;
};
void main()
{
FILE *fp;
char input;
int i,n;
struct bookinf book[N];
for(i=0;i<=N;i++)
{
printf("请输入图书信息(以#结束):\n");
printf("\n书名:");
scanf("%s",book[i].name);
if(strcmp(book[i].name,"#")==0) break;
printf("\n作者:");
scanf("%s",book[i].author);
printf("\n出版年月日(如1993-02-06):");
scanf("%d-%d-%d",&book[i].year,&book[i].month,&book[i].day);
printf("\n价格:");
scanf("%d.%d",&book[i].price1,&book[i].price2);
printf("\n书号:");
scanf("%s",book[i].number);
}
n=i;
fp=fopen("book.txt","w");
for(i=0;i<=n;i++)
{
fputs(book[i].name,fp);
putc(book[i].price1,fp);
putc(book[i].price2,fp);
fputs(book[i].author,fp);
putc(book[i].year,fp);
putc(book[i].month,fp);
putc(book[i].day,fp);
fputs(book[i].number,fp);
}
printf("此次共输入%d本书",n);
}