C语言求改错,不知道哪里有问题



#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<stdlib.h>
#include<string.h>
struct Book {   //每本书对应一个结构体 
    char ID[20];//图书编码 
    char Name[10];//书名 
    char Kind1;//小说 
    char Kind2;//散文
    char Kind3;//纪实 
    char Kind4;//漫画
}books[1000];

int num = 0; //计数器,对应书籍数

void Copy(struct Book* arr, int i, int j)
{
    strcpy(arr[i].ID, arr[j].ID);
    strcpy(arr[i].Name, arr[j].Name);
    strcpy(arr[i].Kind1, arr[j].Kind1);
    strcpy(arr[i].Kind2, arr[j].Kind2);
    strcpy(arr[i].Kind3, arr[j].Kind3);
    strcpy(arr[i].Kind4, arr[j].Kind4);
   
}

int Book_SearchByName(char name[])//通过书名来检索书籍
{
    int i;
    for (i = 0; i < num; i++)
    {
        if (strcmp(books[i].Name, name) == 0)  //通过strcmp函数来对比书名,找到返回在数组的位置 
        {
            return i;
        }
    }
    return -1;    //未找到返回 -1 
}

int Book_SearchByIndex(char id[])//通过学号来检索书籍信息
{
    int i;
    for (i = 0; i < num; i++)
    {
        if (strcmp(books[i].ID, id) == 0)
        {
            return i;
        }
    }
    return -1;
}
void Book_DisplaySingle(int index)  //输出表头,显示某本书的信息
{
    printf("%10s%10s%10s%10s%10s%10s\n", "图书编码", "书名", "小说", "散文", "纪实", "漫画");
    printf("-------------------------------------------------------------\n");
    printf("%10s%10s%8.2s%8.2s%8.2s%8.2s\n", books[index].ID, books[index].Name,
        books[index].Kind1, books[index].Kind2, books[index].Kind3, books[index].Kind4);
}

void inputt()  
{
    while (1)
    {
        printf("请输入图书编码:");     //依次输入各项数据
        scanf("%s", books[num].ID);
        getchar();                 //接收缓冲区中的回车符

        printf("请输入书名:");
        scanf("%s", books[num].Name);
        getchar();
        printf("请输入小说:");
        scanf("%s", books[num].Kind1);
        getchar();
        printf("请输入散文:");
        scanf("%s", books[num].Kind2);
        getchar();
        printf("请输入纪实:");
        scanf("%s", books[num].Kind3);
        getchar();
        printf("请输入漫画:");
        scanf("%s", books[num].Kind4);
        getchar();
      
        if (Book_SearchByIndex(books[num].ID) == -1) 
        {
            num++;  //移向下一个位置,第1个学生num=0,先输入然后num+1
        }
        else
        {
            printf("学号重复,输入数据无效 !!!\n");
        }

        printf("是否继续?(y/n)");
        if (getchar() == 'n')
        {
            break;
        }
    }
}


void modify()
{
    while (1)
    {
        char id[20];
        int index;
        printf("请输入要修改的图书编码:");
        scanf("%s", &id);
        getchar();     //接收缓冲区中的回车符
        index = Book_SearchByIndex(id);  //调用搜查id函数,根据其返回值确定位置 

        if (index == -1)
        {
            printf("书籍不存在!\n");
        }
        else
        {
            printf("你要修改的学生信息为:\n");
            Book_DisplaySingle(index);
            printf("请输入新值\n");
            printf("请输入图书编码:");
            scanf("%s", books[index].ID);
            getchar();
            printf("请输入书籍名称:");
            scanf("%s", books[index].Name);
            getchar();
            printf("请输入小说:");
            scanf("%s", books[index].Kind1);
            getchar();
            printf("请输入散文:");
            scanf("%s", books[index].Kind2);
            getchar();
            printf("请输入纪实:");
            scanf("%s", books[index].Kind3);
            getchar();
            printf("请输入漫画:");
            scanf("%s", books[index].Kind4);
            getchar();
        }

        printf("是否继续?(y/n)");
        if (getchar() == 'n')
        {
            break;
        }

    }
}

void deletee()//删除书籍信息
{
    int i;
    while (1)
    {
        char id[20];
        int index;
        printf("请输入要删除的书籍的图书编号:");
        scanf("%s", &id);
        getchar();
        index = Book_SearchByIndex(id);   //调用搜查id函数,根据其返回值确定位置 

        if (index == -1)
        {
            printf("书籍不存在!\n");
        }
        else
        {
            printf("你要删除的书籍信息为:\n");
            Book_DisplaySingle(index);
            printf("是否真的要删除?(y/n)");
            if (getchar() == 'y')
            {
                for (i = index; i < num - 1; i++)
                {
                    Copy(books, i, i + 1);
                    books[i] = books[i + 1];
                }
                num--;
            }
            getchar();
        }

        printf("是否继续?(y/n)");
        if (getchar() == 'n')
        {
            break;
        }
    }
}

void display()//打印已录入的学生信息
{
    int a;
    printf("%10s%10s%8s%8s%8s%8s\n", "图书编码", "书名", "小说", "散文", "纪实", "漫画");
    printf("-------------------------------------------------------------\n");
    for (a = 0; a < num; a++)
    {
        printf("%10s%10s%8.2s%8.2s%8.2s%8.2s\n",books[a].ID, books[a].Name,
            books[a].Kind1, books[a].Kind2, books[a].Kind3, books[a].Kind4);
    }
}

void insert()//指定位置插入书籍信息
{
    int a, b, c;
    printf("请输入你要插入的位置");
    scanf("%d", &a);
    if (a > num) {
        printf("输入的位置有误,请重新输入,当前共%d条数据\n", num);
        scanf("%d", &a);
    }

    for (b = num - 1; b >= a - 1; b--)
    {
        //strcpy(books[b+1].ID,books[b].ID);
        //strcpy(books[b+1].Name,books[b].Name);
        //books[b+1].Kind1=books[b].Kind1;
        //books[b+1].Kind2=books[b].Kind2;
        //books[b+1].Kind3=books[b].Kind3;
        //books[b+1].Kind4=books[b].Kind4;
       
        Copy(books, b + 1, b);
    }
    num++;  //计数器+1
    printf("请输入书籍编码:");   //在第a个位置(数组元素下标为a-1)插入书籍信息
    scanf("%s", books[a - 1].ID);
    getchar();
    printf("请输入书名:");
    scanf("%s", books[a - 1].Name);
    getchar();
    printf("请输入小说:");
    scanf("%s", books[a - 1].Kind1);
    getchar();
    printf("请输入散文:");
    scanf("%s", books[a - 1].Kind2);
    getchar();
    printf("请输入纪实:");
    scanf("%s", books[a - 1].Kind3);
    getchar();
    printf("请输入漫画:");
    scanf("%s", books[a - 1].Kind4);  //输入新数据 
    getchar();
   
}

void search()//查询书籍信息
{
    while (1)
    {
        char name[20];
        int index;
        printf("请输入要查询的书名:");
        scanf("%s", &name);
        getchar();
        index =Book_SearchByName(name);   //调用搜查name函数,根据其返回值确定位置 
        if (index == -1)
        {
            printf("书名不存在!\n");
        }
        else
        {
            printf("你要查询的书名为:\n");
            Book_DisplaySingle(index);
        }



        printf("是否继续?(y/n)");
        if (getchar() == 'n')
        {
            break;
        }
    }
}


void Save()
{
    FILE* fp = fopen("temp.txt", "w+");
    fprintf(fp, "%d\n", num);
    for (int i = 0; i < num; i++)
    {
        fprintf(fp, "%s %s %s %s %s %s\n", books[i].ID, books[i].Name, books[i].Kind1, books[i].Kind2, books[i].Kind3, books[i].Kind4);
    }
    fclose(fp);
}

void Load()
{
    FILE* fp = fopen("temp.txt", "r");
    fscanf(fp, "%d\n", &num);
    for (int i = 0; i < num; i++)
    {
        fscanf(fp, "%s %s %s %s %s %s \n", books[i].ID, books[i].Name, books[i].Kind1, books[i].Kind2, books[i].Kind3, books[i].Kind4);
    }
    fclose(fp);
}

/*主程序*/
int main() {
    int i;
    while (1) {
        Load();
        printf("曹乐怡 A22医疗器械工程技术2班 A2226210219 ");
        printf("\t\t\t\t\t-------- 图书管理系统-------\n\n\n\n");     //菜单 
        printf("\t\t\t\t\t1. 增加记录\n\n");
        printf("\t\t\t\t\t2. 修改书籍记录\n\n");
        printf("\t\t\t\t\t3. 删除书籍记录\n\n");
        printf("\t\t\t\t\t4. 插入书籍记录\n\n");
        printf("\t\t\t\t\t5. 显示所有记录\n\n");
        printf("\t\t\t\t\t6. 查询使劲记录\n\n");
        printf("\t\t\t\t\t0. 退出\n\n\n");
        printf("请选择(0-6):");
        scanf("%d", &i);
        switch (i) {
        case 1:inputt(); break;
        case 2:modify(); break;
        case 3:deletee(); break;
        case 4:insert(); break;
        case 5:display(); break;
        case 6:search(); break;
        case 0:exit(0);   // exit(0) 正常退出程序,exit(1)表示异常退出程序
        default:;
        }
        Save();
    }
    return 0;
}

报错提示呢

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^