user-0 提问: 帮忙看一下，哪里错了

回复:
user: user-1
content: 楼主，你学我这样整一下代码，错在哪里 一目了然。。。

user: user-1
content: ///////////////////////////////////////////////////// #include<stdio.h>  #include<malloc.h> #include<string.h> #include<stdlib.h>  #define Booklength 100 #define BookHnum 100 #define ReaderHnum 100  typedef struct {     char bookID[10];     char bookname[81];     int namenext;     char author[10];     int authornext;     char press[81];     int pressnext;     int storenum;     int borrownum; }Booktype;  typedef struct {     Booktype booklen[Booklength];     int len; }Bookfile;  // typedef struct {     char bookID[10];     int Rnum; }BookIDtype;  typedef struct {     BookIDtype BookID[10];     int len; }BookIDfile;   // typedef struct {     char bookname[81];     int head;     int Rnamelen; }Booknametype;  typedef struct {      Booknametype Lhf1[BookHnum];      int len1; }Booknamefile;     // typedef struct {     char author[10];     int head;     int Rauthorlen; }Authortype;  typedef struct {     Authortype Lhf2[BookHnum];     int len2; }Bookauthorfile;  // typedef struct {     char press[10];      int head;     int Rpresslen; }presstype;  typedef struct {     presstype Lhf3[BookHnum];     int len3; }pressfile;  // typedef struct {     char name[10];     char readerID[10]; }Readertype;  typedef struct {     Readertype reader[ReaderHnum];     int len; }Readerfile;  typedef struct  {     char readerID[10];     char bookID[10];     char data1[10];     char data2[10]; }Borrowtype;  typedef struct {       Borrowtype Borrowbook[Booklength];     int len; }Borrowfile;  void AddBaserecord(Bookfile &file) {     int i;     i=++file.len;      printf("书号 书名 作者名 出版社 藏书量\n");      scanf("%s%s",file.booklen[i].bookID,file.booklen[i].bookname);      scanf("%s%s",file.booklen[i].author,file.booklen[i].press);      scanf("%s",&file.booklen[i].storenum);      file.booklen[i].borrownum=0; }  void changeBaserecord(Bookfile &file,BookIDfile &f) {     int i,j,k;     char str[10];     i=file.len;      strcpy(str,file.booklen[i].bookID);          j=file.len;     k=1;     while(j>=1)     {         if(strcpy(str,f.BookID[i].bookID)>0)         {             k=j+1;             break;         }         j++;     }      if(f.len>0)         for(j=f.len;j>=k;j--)             f.BookID[j+1]=f.BookID[j];          strcpy(f.BookID[i].bookID,str);     f.BookID[i].Rnum=i;     f.len++; }  void changeBookname(Bookfile &file,Booknamefile&f) {     int i,j,k,m;     char str[20];          i=file.len;     strcpy(str,file.booklen[i].bookname);          j=0;     k=0;     while(j<f.len1)     {         if(strcpy(str,f.Lhf1[i].bookname)==0)         {             k=j;break;         }         j++;     }      if(k!=0)     {         file.booklen[i].authornext=f.Lhf1[k].head;         f.Lhf1[k].head=i;         f.Lhf1[k].Rnamelen++;     }     else      {         m=++f.len1;         file.booklen[i].namenext=0;         f.Lhf1[k].head=i;         f.Lhf1[k].Rnamelen=1;         strcpy(f.Lhf1[m].bookname,str);     } }  void changeauthor(Bookfile &file,Bookauthorfile&f) {     int i,j,k,m;     char str[10];     i=file.len ;     strcpy(str,file.booklen[i].author);          j=0;k=0;      while(j<f.len2)     {         if(strcpy(str,f.Lhf2[i].author)==0)         {             k=j;             break;         }         j++;     }     if(k!=0)     {         file.booklen[i].namenext=f.Lhf2[k].head;         f.Lhf2[k].head=i;         f.Lhf2[k].Rauthorlen++;     }     else      {         m=++f.len2;         file.booklen[i].authornext=0;         f.Lhf2[k].head=i;         f.Lhf2[k].Rauthorlen=1;         strcpy(f.Lhf2[m].author,str);     } }  void changepress(Bookfile &file,pressfile&f) {     int i,j,k,m;     char str[10];     i=file.len ;         strcpy(str,file.booklen[i].press);     j=0;k=0;     while(j<f.len3)     {         if(strcpy(str,f.Lhf3[i].press)==0)         {             k=j;             break;         }         j++;     }     if(k!=0)     {         file.booklen[i].pressnext=f.Lhf3[k].head;         f.Lhf3[k].head=i;         f.Lhf3[k].Rpresslen++;     }     else      {         m=++f.len3;         file.booklen[i].pressnext=0;         f.Lhf3[k].head=i;         f.Lhf3[k].Rpresslen=1;         strcpy(f.Lhf3[m].press,str);     } }  void createbook(Bookfile &file,BookIDfile &f,Booknamefile &f1,Bookauthorfile &f2,pressfile &f3) {     system(＂cls＂);     char i;     while(i='y')     {               AddBaserecord(file);         changeBaserecord(file,f);         changeBookname(file,f1);         changeauthor(file,f2);          changepress(file,f3);          printf("继续？y  or n");         scanf("%c",&i);     } }  int IDsearch(BookIDfile &f,char key[]) {     int low,high,mid;     low=0;     high=f.len;     while(low<high)     {         mid=(mid+high)/2;         if(strcmp(key,f.BookID[mid].bookID)==0)         {             return f.BookID[mid].Rnum;         }         else if(strcmp(key,f.BookID[mid].bookID)<0)         {             high=mid-1;         }         else             low=mid+1;     }     return 0; } ///////////////////////////////////////////////////////////////

user: user-0
content: int main() { 	int j,k=1,m; 	char x='z'; 	    Bookfile bf; 		BookIDfile bif; 		Booknamefile f1; 		Bookauthorfile f2; 		pressfile f3;         Readerfile rf; 		Borrowfile bbf;  while(k<=5) { 	 printf("图书管理系统\n"); 	 printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); 	 printf("1读者管理\n "); 	 printf(" 2图书管理\n "); 	 printf(" 3借还系统\n "); 	 printf(" 4退出系统\n ");      printf(" 5读出所有文件\n"); 	 printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); 	 scanf("%d",&k); 	 switch(k) 	 { 	 case 1:readerrecord(rf); 		 break; 	 case 2:printf("图书管理子系统\n");system(＂cls＂);      printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");      printf("1图书输入\n ");      printf(" 2图书查询\n");      printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");      scanf("%d",&j);      if(j==1)      createbook(bf,bif,f1,f2,f3);      else searchbook(bf,bif,f1,f2,f3);break; 	 case 3: 		 printf("借还系统\n");      printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");      printf("1借书\n ");      printf(" 2还书\n");      printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");      scanf("%d",&j);      if(j==1)      borrowrecord(bf,bif,bbf,rf);      else back(bf,bif,bbf,rf);break; 	 case 4: 		 printf("退出系统\n"); 		 creatfile(bf,bif,f1,f2,f3,rf,bbf);break; 	case 5:	 readfile(bf,bif,f1,f2,f3,rf,bbf);return 0; 		   	 } }  return 0; }

user: user-2
content: 几点建议： 1、用代码格式来写，一个文件一个代码块，比如： //test.cpp//main.cpp 2、请输出错误信息，我们并不想再运行一遍，最好再写出运行到哪里出错，自己先设断点调试下。 3、如果是逻辑错误，请写出预期输出，和实际输出，好做分析。

user: user-3
content: 编译到哪里错了？ 运行到哪里错了？