这时我的程序,请高手指点
#include<iostream.h>
#include<stdio.h>
#include<string.h>
#include<process.h>
class book
{friend class list;
 private :char name[20];
    char tele[11];
    int n;
    book*next;
};
class list
{private:book*head,*tail,*now;
 public:
    list();
    void init(void);
    void print1(void);
    void add(void);
    void search(void);
    void del(void);
   // void modify(void);
    void exit(void);
};
int main(void)
{char ch;
  cout<<"Hello!";
  list list1;
  
  list1.init();
L1:cout<<"press 1 to print the telephone book";
   cout<<"press 2 to add record to the telephone book";
   cout<<"press 3 to delete a record in the telephone book";
   cout<<"press 4 to modify the telephone book";
   cout<<"press 5 to search a record in the telephone book";
   cout<<"press 6 to exit the program";
   cin>>ch;
while(1)
{  switch(ch)
{case'1':list1.print1();break;
  case'2':list1.add();break;
  case'3':list1.del();break;
  //case'4':list1.modify();break;
  case'5':list1.search();break;
  case'6':list1.exit();break;
  default:
   {cout<<"please input a right number";
    goto L1;
   }
   break;
}
 cin>>ch;
}
 return 0;
}
  list::list(void)
  {head=tail=now=0;}
void list::print1(void)
 {int i;
  now=head;
  cout<<"name  telephone  n  "<<endl;
  for(i=0;i<tail->n;i++)
  {cout<<now->name<<"  "<<now->tele<<"  "<<now->n<<endl;
   now=now->next;
  }
 
 }
 
 
 void list::add(void)
 {now=new book;
  cout<<"name:";
  cin>>now->name;
  cout<<endl<<"telephone:";
  cin>>now->tele;
  now->n=tail->n+1;
  tail->next=now;
  tail=now;
  
 }
 void list::del(void)
 {book*a;
 char na[20];
 int i,k=0;
 char m;
  cout<<"Input the name you want to delete:";
  cin>>na;
  now=a=head;
  for(i=0;i<tail->n;i++)
   if(!strcmp(a->name,na))
   {   cout<<"name  telephone  n  "<<endl;
       cout<<a->name<<"  "<<a->tele<<"  "<<a->n<<endl;
    k++;
       cout<<"Do you want to delete it?(Y/N)";
       cin>>m;
       if(m=='y'||m=='Y')
    {now->next=a->next;
     delete a;
     a=now->next;
    }
   }
        else 
  {now=a;
   a=a->next;
        }
  if(k==0)
   cout<<"there is no such person";
 }
 void list::search(void)
 {int i,k=0;
  char na[20];
  cout<<"Input the name you want to find:";
  cin>>na;
  now=head;
  for(i=0;i<tail->n;i++)
   if(!strcmp(now->name,na))
   {   cout<<"This is the record you want to find:"<<endl;
    cout<<"name  telephone  n  "<<endl;
       cout<<now->name<<"  "<<now->tele<<"  "<<now->n<<endl;
    k++;
      }
      else
    now=now->next;
  if(k==0)
      cout<<"there is no such person";
 }
 void list::exit(void)
 {int i;
  FILE*fp;
  if((fp=fopen("telebook.dat","w"))==NULL)
   cout<<"wrong";
   else 
    cout<<"success";
  now=head;
  for(i=0;i<tail->n;i++)
  {fwrite(now,sizeof(book),1,fp);
   now=now->next;
  }
  fclose(fp);
  now=head;
  for(i=0;i<tail->n;i++)
  {head=head->next;
   delete now;
   now=head;
  }
  exit();
 }
void list::init(void)
 { FILE*fp;
   book buffer;
   cout<<"name:";
 cin>>buffer.name;
 cout<<endl<<"telephone:";
 cin>>buffer.tele;
 buffer.n=1;
  if((fp=fopen("telebook.dat","w"))==NULL)
   cout<<"wrong";
   else 
    cout<<"success";
 fwrite(&buffer,sizeof(book),1,fp);
 fclose(fp);
   if((fp=fopen("telebook.dat","r"))==NULL)
   cout<<"wrong";
   else 
    cout<<"success";
   while(!feof(fp))
   {fread(&buffer,sizeof(book),1,fp);
    if(buffer.n==1)
 {head=now=tail=new book;
  strcpy(tail->name,buffer.name);
  strcpy(tail->tele,buffer.tele);
     tail->n=buffer.n;
 }
 else
 {tail=new book;
  now->next=tail;
     strcpy(tail->name,buffer.name);
  strcpy(tail->tele,buffer.tele);
     tail->n=buffer.n;
 }
    fclose(fp);
  }
}