结构体 运行有错
程序代码:#include <stdio.h>
#define maxbk 100
#define maxat 40
#define maxtt 40 //最多可以容纳100本书
struct book { //book模板
char title[maxtt];
char author[maxat];
float value;
};
int main (void)
{
struct book library[maxbk];
int count = 0;
int index;
printf ("input the book's title.\n");
while (count < maxbk && gets (library[count].title) != NULL && library[count].title[0] != '\0')
{
printf ("now enter the author.\n");
scanf ("%s", library[count].author);
printf ("now enter the price.\n");
scanf ("%f", library[count++].value);
while (getchar () != '\n') //清空输入行
continue;
if (count < maxbk)
printf ("enter the next title.\n");
}
if (count > 0)
{
printf ("here is the list of your books.\n");
for(index = 0; index < count; index++)
printf ("%s by %s :$%.2f\n", library[index].title, library[index].author, library[index].value);
}
else
printf ("......");
return 0;
}本代码没有错误,没有警告,可运行,但是不知道为什么输入第一本书的三个信息后按“enter”,然后就会弹出“结构体.exe”遇到错误。请问怎么会这样的呢?之前是这样,然后我换了个系统,还是这样,不解







