报错,//图书管理#include #define LEN sizeof(struct)void add_book();struct Book{int num;char name[20];char author[20];struct Book *next;};int main(){\x05int funk;\x05int a;\x05struct book *head=NULL;\x05\x05printf("本软件有4项功能:\n\n")

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/01 04:55:02

报错,//图书管理#include #define LEN sizeof(struct)void add_book();struct Book{int num;char name[20];char author[20];struct Book *next;};int main(){\x05int funk;\x05int a;\x05struct book *head=NULL;\x05\x05printf("本软件有4项功能:\n\n")
报错,
//图书管理
#include
#define LEN sizeof(struct)
void add_book();
struct Book
{
int num;
char name[20];
char author[20];
struct Book *next;
};
int main()
{
\x05int funk;
\x05int a;
\x05struct book *head=NULL;
\x05
\x05printf("本软件有4项功能:\n\n");
\x05printf(" 1.添加图书\n 2.删除图书\n 3.查看图书 4.修改图书\n\n");
\x05printf("请输入功能标号以实现功能\n");
\x05scanf("%d" ,&funk);
\x05//if((funk >= 1)&&(funk num);
\x05printf("请输入增加图书的名称:\n");
\x05scanf("%s" ,&p1->name);
\x05printf("请输入增加图书的作者:\n");
\x05scanf("%s" ,&p1->author);
\x05fprintf(fp,"%d ,%s ,%s",p1->num ,p1->name ,p1->author);
\x05
\x05while(p1->num!=0)
\x05{
\x05\x05n = n + 1;
\x05\x05if(n == 1)
\x05\x05{
\x05\x05\x05head = p1;\x05
\x05\x05}
\x05\x05else
\x05\x05{
\x05\x05\x05p2 -> next = p1;
\x05\x05}
\x05\x05p2 = p1;
\x05\x05p1 = (struct Book *)malloc(LEN);
\x05\x05printf("请输入增加图书的数量:\n");
\x05\x05scanf("%d" ,&p1->num);
\x05\x05printf("请输入增加图书的名称:\n");
\x05\x05scanf("%s" ,&p1->name);
\x05\x05printf("请输入增加图书的作者:\n");
\x05\x05scanf("%s" ,&p1->author);
\x05\x05fprintf(fp,"%d ,%s ,%s",p1->num ,p1->name ,p1->author);
\x05}
\x05p2 -> next = NULL;
}
/*void del_book(struct book *head)
{
\x05
\x05
\x05printf("请输入你要删除的图书名称:\n");
\x05scanf("%s",&name);
\x05
\x05
\x05
\x05
\x05
\x05
\x05
\x05
\x05
\x05
\x05
}
void scan_book(struct book *head)
{
\x05struct book *p;
\x05p = head;
\x05
\x05if(head = NULL)
\x05{
\x05\x05do
\x05\x05{
\x05\x05\x05printf("%d %s %s",p->)
\x05\x05}
\x05}
\x05
\x05
\x05
\x05
\x05printf("所有的图书为:\n");
\x05
\x05
\x05
\x05
\x05
\x05
\x05
\x05
\x05
\x05
\x05
}
*/

报错,//图书管理#include #define LEN sizeof(struct)void add_book();struct Book{int num;char name[20];char author[20];struct Book *next;};int main(){\x05int funk;\x05int a;\x05struct book *head=NULL;\x05\x05printf("本软件有4项功能:\n\n")
第四行改为:#define LEN sizeof(struct Book)