int input(struct library book[]) { int i,n; system("cls"); printf("\t输入图书的数量: An"); scanf("\t\t\t\t%d",&n); system("cls"); printf("\t开始输入记录: An"); for(i =0; i<n;i++) { printf("\n\t第d条记录的图书编号:",i+1);scanf("\t%d",&book[i].book_num); printf("\n\t第d条记录的图书名称:",i+1); scanf("\t%s",&book[i].book_name); printf("\n\t第d条记录的图书作者姓名:",i+1); 填空_ ■ printf("\n\t第d条记录的图书价格:",i+1); 填空_ 声 printf("\n\t第d条记录的图书出版社:",i+1); scanf("\t%s",&book[i]-publisher); printf("\n\t第d条记录的图书出版时间:",i+1); scanf("\t%d-%d-%d",&book[i]:publish_time-year,&book[i]-publish_time.month,&book[i]-publish_time.day);printf("\n\t第d条记录的图书存在状态(y/n):",i+1);scanf("\t%s",&book[i].book_state); 帮我找到错误的地方并改正
时间: 2023-08-07 21:03:05 浏览: 99
int input(struct library book[])
{
int i, n;
system("cls");
printf("\t输入图书的数量:\n");
scanf("%d", &n);
system("cls");
printf("\t开始输入记录:\n");
for (i = 0; i < n; i++)
{
printf("\n\t第%d条记录的图书编号:", i + 1);
scanf("%d", &book[i].book_num);
printf("\n\t第%d条记录的图书名称:", i + 1);
scanf("%s", book[i].book_name);
printf("\n\t第%d条记录的图书作者姓名:", i + 1);
scanf("%s", book[i].author_name);
printf("\n\t第%d条记录的图书价格:", i + 1);
scanf("%lf", &book[i].book_price);
printf("\n\t第%d条记录的图书出版社:", i + 1);
scanf("%s", book[i].publisher);
printf("\n\t第%d条记录的图书出版时间:", i + 1);
scanf("%d-%d-%d", &book[i].publish_time.year, &book[i].publish_time.month, &book[i].publish_time.day);
printf("\n\t第%d条记录的图书存在状态(y/n):", i + 1);
scanf(" %c", &book[i].book_state); // 注意这里使用 %c,因为状态是单个字符
}
}
阅读全文