blueboy来了~~~不明白调式是怎么回事。能具体说一下么?点击取消后进入画面,箭头指向void showlist(node *head)里面的
cout<<pRead->data;这一句。
#include<iostream.h> 
struct node
{
    char data;
    node * next;
};
node *great();
node *search(node * head,char keyword);
void Insert(node * &head,char keyword,char newword);
void Delete(node * &head,char keyword);
void showlist(node *head);
void destroy(node *node);
int main()
{
    char a,keyword,newword;
    node *head=NULL;
    int chance;
    do
    {
        cout<<"你要执行的操作:1,创建;2,读取;3,插入;4,删除;5,退出"<<endl;
        cin>>chance;
        switch(chance)
        {
        case 1:{if(head!=NULL) destroy(head);head=great();break;}
        case 2:{showlist(head);break;}
        case 3:{
            cout<<"你要插入的位置:";
            cin>>newword;
            Insert(head,keyword,newword);
            break;
               }
        case 4:{
        cout<<"你要删除的内容:"<<endl;
        cin>>keyword;
        Delete(head,keyword);
        break;
               }
        case 5:{
            destroy(head);
            break;
               }
default:cout<<"没有这个选项"<<endl;
        }
        cout<<"是否要继续?(Y/N)";
        cin>>a;
    }while(a=='Y'||a=='y');
    return 0;
}
node *great()
{
    node *head=NULL;
    head=new node;
  node *pEnd=head;
  node *ps;
  char temp;
  cout<<"请输入数据。以#号结束。"<<endl;
  do
  {
      cin>>temp;
      if(head==NULL)
      {
          head->data=temp;
          head->next=pEnd;
      }
      else
      {
          ps=new node;
          ps->data=temp;
          pEnd->next=ps;
          pEnd=ps;
      }
  }while(temp!='#');
  return head;
}
node *search(node *head,char keyword)
{
    node *pRead=head;
    while(pRead!=NULL)
    {
        if(pRead->data==keyword)
            return pRead;
        pRead=pRead->next;
    }
    return NULL;
}
void showlist(node *head)
{
    node *pRead=head;
    cout<<"连表内的数据是:";
    while(pRead!=NULL)
    {
        cout<<pRead->data;                 //////////////////调式的时候指向这一句
        pRead=pRead->next;
    }
    cout<<endl;
}
void Insert(node * &head,char keyword,char newword)
{
node *newnode=new node;
newnode->data=newword;
node *pGuard=search(head,keyword);
if(head==NULL||pGuard==NULL)
{
    newnode->next=head;
    head=newnode;
    return;
}
newnode->next=pGuard->next;
pGuard->next=newnode;
}
void Delete(node * &head,char keyword)
{
    node *pGuard=head;
    node *p;
    if(head!=NULL)
    {
        if(head->data=keyword)
        {
            p=head;
            head=head->next;
            delete p;
            cout<<"已经删除:"<<keyword<<endl;
            return;
        }
        else
        {
            while(pGuard->next!=NULL)
            {
            if(pGuard->next->data=keyword)
            {
                p=pGuard->next;
                pGuard->next=p->next;
                delete p;
                cout<<"已经删除:"<<keyword<<endl;
                return;
            }
            pGuard=pGuard->next;
            }
        }
        
    }
cout<<"你要删除的数据不存在或者连表是空"<<endl;
}
void destroy(node *head)
{
    node *p;
    while(head!=NULL)
    {
        p=head;
        head=head->next;
        delete p;
    }
    cout<<"连表已删除"<<endl;
}