user-0 提问: 求助，c语言作业，不太会

回复:
user: user-1
content: 一堆问题。基本的问题有三：1，int loadrecord（） 函数申明与函数原型 参数数量都不同。2，打印出版时间的地方，是要打印年月日的。 参数却少了年月日。3，有个函数定义的地方，括号混乱。 是哪儿抄的作业。。。抄都抄不整齐。

user: user-2
content: int loadrecord(struct library book[],int n);声明的时候是两个形参。int loadrecord(struct library book[]){}  函数实现时只有一个参数。排版 修改如下，供参考： #include<stdio.h> #include<stdlib.h> #include<string.h> #include<ctype.h> #include"windows.h" #define M 50   struct date {      int year;      int month;      int day; };  struct library {     int  book_num;     char book_name[40];     char author_name[10];     float book_price;     char publisher[40];     struct date publish_time;     char book_state[2];     char reader_name[10];     int reader_num; };  int input(struct library book[]); int add(struct library book[],int n); void list(struct library book[],int n); void search_num(struct library book[],int n); void search_name(struct library book[],int n); int Delete(struct library book[],int n); void sort(struct library book[],int n); void count(struct library book[],int n); void unborrow(struct library book[],int n); void search_publisher(struct library book[],int n); void saverecord(struct library book[],int n); int loadrecord(struct library book[]);       //,int n); int menu();  void main() {     struct library b[M];     int    length;     while(1)     {       switch(menu())     {              case 1:length=input(b);                     if(length==-1)break;                     else                       saverecord(b,length);                     break;              case 2:length=loadrecord(b);                     length=add(b,length);                     saverecord(b,length);                     break;              case 3:length=loadrecord(b);                     list(b,length);                     break;              case 4:length=loadrecord(b);                     search_num(b,length);                     break;              case 5:length=loadrecord(b);                     search_name(b,length);                     break;              case 6:length=loadrecord(b);                     length=Delete(b,length);                     saverecord(b,length);                     break;              case 7:length=loadrecord(b);                     sort(b,length);                     saverecord(b,length);                     list(b,length);                     break;              case 8:length=loadrecord(b);                     count(b,length);                     saverecord(b,length);                     break;              case 9:length=loadrecord(b);                     unborrow(b,length);              case 10:length=loadrecord(b);                     search_publisher(b,length);                     break;              case 0:exit(0);     }     } } int menu() {    int c;    system("mode con:cols=400 lines=30000"); //调节控制台的宽度和高度    system("color 0b");  //调节控制台的背景和字体颜色      printf("\t\t\t\t\t-------------------------------------------------\n");    printf("\t\t\t\t\t+ 图书信息管理系统         +\n");    printf("\t\t\t\t\t-------------------------------------------------\n");    printf("\t\t\t\t\t\t\t ***************\n");    printf("\t\t\t\t\t\t\t 1. 初始化图书信息\n");                             printf("\t\t\t\t\t\t\t 2. 添加图书信息\n");                       printf("\t\t\t\t\t\t\t 3. 显示图书信息\n") ;    printf("\t\t\t\t\t\t\t 4. 按图书编号查询图书信息\n");         printf("\t\t\t\t\t\t\t 5. 按图书名称查询图书信息\n");                     printf("\t\t\t\t\t\t\t 6. 按图书名称删除图书信息\n");         printf("\t\t\t\t\t\t\t 7. 按图书名称从小到大排序图书信息\n");                       printf("\t\t\t\t\t\t\t 8. 按价格统计图书信息\n") ;    printf("\t\t\t\t\t\t\t 9. 显示未借出图书信息\n");    printf("\t\t\t\t\t\t\t 10. 修改图书信息\n");    printf("\t\t\t\t\t\t\t 11. 按出版社名称查询图书信息\n");    printf("\t\t\t\t\t\t\t 0. 退出\n") ;                                           printf("\t\t\t\t\t\t\t ***************\n");     do{        printf("\n  Enter your choice(0-10):");              if(scanf("%d",&c)!=1)        {  while(getchar()!='\n')             continue;             continue;        }     }while(c<0||c>11);     return c; } int input(struct library book[]) {     int i,n;     system("cls");     printf("\t输入图书的数量：\n");     scanf("\t\t\t\t%d",&n);     system("cls");     printf("\t开始输入记录：\n");     for(i=0;i<n;i++)     {          printf("\n\t第%d条记录的图书编号：",i+1);          scanf("\t%d",&book[i].book_num);           printf("\t第%d条记录的图书名称：",i+1);          scanf("\t%s",book[i].book_name);           printf("\t第%d条记录的图书作者姓名：",i+1);          scanf("\t%s",book[i].author_name);           printf("\t第%d条记录的图书价格：",i+1);          scanf("\t%f",&book[i].book_price);           printf("\t第%d条记录的图书出版社：",i+1);          scanf("\t%s",book[i].publisher);           printf("\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("\t第%d条记录的图书存在状态(y/n)：",i+1);          scanf("\t%s",book[i].book_state);           printf("\t第%d条记录的读者姓名：",i+1);          scanf("\t%s",book[i].reader_name);           printf("\t第%d条记录的读者学号：",i+1);          scanf("\t%d",&book[i].reader_num);     }     printf("\t******************\n");     printf("\t   已输入成功！\n");     printf("\t  press any key enter menu......\n");     printf("\t******************\n");     getchar();     getchar();     system("cls");     return n; }   int add(struct library book[],int n) {     int i,m;     system("cls");     printf("\t输入再增加的记录数：\n");     scanf("%d",&m);     printf("\t开始输入记录：\n");     for(i=n;i<n+m;i++)     {         printf("\n\t第%d条记录的图书编号：",i+1);         scanf("\t%d",&book[i].book_num);          printf("\t第%d条记录的图书名称：",i+1);         scanf("\t%s",book[i].book_name);          printf("\t第%d条记录的图书作者姓名：",i+1);         scanf("\t%s",book[i].author_name);          printf("\t第%d条记录的图书价格：",i+1);         scanf("\t%f",&book[i].book_price);          printf("\t第%d条记录的图书出版社：",i+1);         scanf("\t%s",book[i].publisher);          printf("\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("\t第%d条记录的图书存在状态(y/n)：",i+1);         scanf("\t%s",book[i].book_state);          printf("\t第%d条记录的读者姓名：",i+1);         scanf("\t%s",book[i].reader_name);          printf("\t第%d条记录的读者学号：",i+1);         scanf("\t%d",&book[i].reader_num);     }     printf("\t******************\n");     printf("\t   已输入成功！\n");     printf("\t  press any key enter menu......\n");     printf("\t******************\n");     getchar();     getchar();     system("cls");     return (n+m); } void list(struct library book[],int n) {      int i;      system("cls");        printf("\t图书馆图书信息如下:\n");      printf("\t图书编号\t图书名称\t作者\t单价\t出版社\t\t出版时间\t存在状态\t读者姓名\t读者学号\n");      for(i=0;i<n;i++)      {           printf("\t%6d\t%12s\t%10s\t%4.2f\t%6s\t",book[i].book_num,book[i].book_name,                              book[i].author_name,book[i].book_price,book[i].publisher);           printf("\t%4d-%2d-%2d\t%2s\t%6s\t%8d\t\n",book[i].publish_time,book[i].book_state,                                                      book[i].reader_name,book[i].reader_num);      }       printf("\t***************************\n");      printf("\t  press any key enter menu......\n");      printf("\t***************************\n");      getchar();      getchar();      system("cls"); } void search_num(struct library book[],int n) {     int i,flag=0;     int bnum;     system("cls");     printf("\t输入查询编号：\n");     scanf("%d",&bnum);     for(i=0;i<n;i++)     {         if(book[i].book_num==bnum)             flag=1;         system("cls");         printf("\t图书馆图书信息如下:\n");         printf("\t图书编号\t图书名称\t作者\t单价\t出版社\t\t出版时间\t存在状态\t读者姓名\t读者学号\n");         printf("\t%6d\t%12s\t%10s\t%4.2f\t%6s\t",book[i].book_num,book[i].book_name,                            book[i].author_name,book[i].book_price,book[i].publisher);         printf("\t%4d-%2d-%2d\t%2s\t%6s\t%8d\t\n",book[i].publish_time,book[i].book_state,                                                    book[i].reader_name,book[i].reader_num);         printf("\t***************************\n");         printf("\t  press any key enter menu......\n");         printf("\t***************************\n");         getchar();         getchar();         system("cls");     }     if(flag==0)     {         printf("查无此书！\n");         printf("\t***************************\n");         printf("\t  press any key enter menu......\n");         printf("\t***************************\n");         getchar();         getchar();         system("cls");     } }   void search_name(struct library book[],int n) {     int i,flag=0;     char bname[10];     system("cls");     printf("\n请输入要查询的图书书名:");     scanf("%s",bname);     for(i=0;i<n;i++)     {        if(strcmp(bname,book[i].book_name)==0)        {           flag=1;           system("cls");           printf("\t此书的信息如下：\n");           printf("\t图书编号\t图书名称\t作者\t单价\t出版社\t\t出版时间\t存在状态\t读者姓名\t读者学号\n");           printf("\t%6d\t%12s\t%10s\t%4.2f\t%6s\t",book[i].book_num,book[i].book_name,                              book[i].author_name,book[i].book_price,book[i].publisher);           printf("\t%4d-%2d-%2d\t%2s\t%6s\t%8d\t\n",book[i].publish_time,                                  book[i].book_state,book[i].reader_name,book[i].reader_num);           printf("\t***************************\n");           printf("\t  press any key enter menu......\n");           printf("\t***************************\n");           getchar();           getchar();           system("cls");        }     }     if(flag==0)     {          printf("没有此书!\n");           printf("\t***************************\n");          printf("\t  press any key enter menu......\n");          printf("\t***************************\n");          getchar();          getchar();          system("cls");     } }  int Delete(struct library book[],int n) {     int i,j,flag=0;     char bname[10];     char ch='n';     system("cls");     printf("请输入要删除的图书名字\n");     scanf("%s",bname);     for(i=0;i<n;i++)     {        if(strcmp(bname,book[i].book_name)==0)        {           flag=1;           printf("\t此书的信息如下:\n");           printf("\t图书编号\t图书名称\t作者\t单价\t出版社\t\t出版时间\t存在状态\t读者姓名\t读者学号\n");           printf("\t%6d\t%12s\t%10s\t%4.2f\t%6s\t",book[i].book_num,book[i].book_name,                              book[i].author_name,book[i].book_price,book[i].publisher);           printf("\t%4d-%2d-%2d\t%2s\t%6s\t%8d\t\n",book[i].publish_time,book[i].book_state,                                                      book[i].reader_name,book[i].reader_num);                       printf("是否要删除此条信息!(y/n):");           ch=getchar();           ch=getchar();           if(ch=='y'||ch=='Y')           {              for(j=i;j<n-1;j++)                  book[j]=book[j+1];              n--;              printf("是否要删除此信息！(y/n):");           }           printf("\t***************************\n");           printf("\t  press any key enter menu......\n");           printf("\t***************************\n");           getchar();           getchar();           system("cls");        }     }     if(flag==0)     {          printf("\t  查无此书！\n");           printf("\t***************************\n");          printf("\t  press any key enter menu......\n");          printf("\t***************************\n");          getchar();          getchar();           system("cls");     }     return n; } void sort(struct library book[],int n) { } void count(struct library book[],int n) {      int i,count1=0;float p;      system("cls");      printf("请输入任意一个价格：");      scanf("%f",&p);       for(i=0;i<n;i++)      {          if(book[i].book_price>p)            count1++;      }      printf("\t图书的数量为:%d \n\n\n\n",count1);       printf("\t***************************\n");      printf("\t  press any key enter menu......\n");      printf("\t***************************\n");      getchar();      getchar();      system("cls"); }  void unborrow(struct library book[],int n) { }  void saverecord(struct library book[],int m)//初始化图书信息else {     int i;     FILE *fp;     if((fp=fopen("record.txt","w"))==NULL)     {        printf("无法录入信息!!\n");        exit(1);     }     for(i=0;i<m;i++)       fwrite(&book[i],sizeof(struct library),1,fp);     fclose(fp); } int loadrecord(struct library book[])//添加图书信息else {     int n=0;     FILE *fp;     if((fp=fopen("record.txt","r"))==NULL)     {         printf("无法录入信息!!\n");         exit(0);     }     while(fread(&book[n],sizeof(struct library),1,fp))n++;     fclose(fp);     printf("从文件中成功读出记录!!!\n");     return n; }  void search_publisher(struct library book[],int n) {     int i,flag=0;     char bpublisher[10];     system("cls");     printf("\n请输入要查询的出版社名称:");     scanf("%s",bpublisher);     for(i=0;i<n;i++)     {         if(strcmp(book[i].publisher,bpublisher)==0)         {            flag=1;            system("cls");            printf("\t此书的信息如下：\n");            printf("\t图书编号\t图书名称\t作者\t单价\t出版社\t\t出版时间\t存在状态\t读者姓名\t读者学号\n");            printf("\t%6d\t%12s\t%10s\t%4.2f\t%6s\t",book[i].book_num,book[i].book_name,                               book[i].author_name,book[i].book_price,book[i].publisher);            printf("\t%4d-%2d-%2d\t%2s\t%6s\t%8d\t\n",book[i].publish_time,book[i].book_state,                                                       book[i].reader_name,book[i].reader_num);            printf("\t***************************\n");            printf("\t  press any key enter menu......\n");            printf("\t***************************\n");            getchar();            getchar();            system("cls");         }     }     if(flag==0)     {       printf("没有此书!\n");        printf("\t***************************\n");       printf("\t  press any key enter menu......\n");       printf("\t***************************\n");       getchar();       getchar();       system("cls");     }     //}     //return n; }

user: user-0
content: C:\Users\lenovo\Desktop\wangyujie.cpp(53) : error C2660: 'loadrecord' : function does not take 1 parametersC:\Users\lenovo\Desktop\wangyujie.cpp(57) : error C2660: 'loadrecord' : function does not take 1 parametersC:\Users\lenovo\Desktop\wangyujie.cpp(60) : error C2660: 'loadrecord' : function does not take 1 parametersC:\Users\lenovo\Desktop\wangyujie.cpp(63) : error C2660: 'loadrecord' : function does not take 1 parametersC:\Users\lenovo\Desktop\wangyujie.cpp(66) : error C2660: 'loadrecord' : function does not take 1 parametersC:\Users\lenovo\Desktop\wangyujie.cpp(70) : error C2660: 'loadrecord' : function does not take 1 parametersC:\Users\lenovo\Desktop\wangyujie.cpp(75) : error C2660: 'loadrecord' : function does not take 1 parametersC:\Users\lenovo\Desktop\wangyujie.cpp(79) : error C2660: 'loadrecord' : function does not take 1 parametersC:\Users\lenovo\Desktop\wangyujie.cpp(81) : error C2660: 'loadrecord' : function does not take 1 parametersC:\Users\lenovo\Desktop\wangyujie.cpp(416) : error C2601: 'search_publisher' : local function definitions are ille这是显示错误的地方