c++创建了一个单链表,定义了多个函数,但是只运行了一个函数

编译器为Vscode
代码如下:

#include<iostream>
#include<string>
using namespace std;
typedef struct touch
{
    string name;
    string address;
    string mailcode;
    string telephone;
    string email;
    touch *next;
}Touch;
Touch *Storetouch()
{
    Touch *head=NULL;
    Touch *tail=NULL;
    int number=0;
    cout<<"请输入要存取的数据个数:";
    cin>>number;
    cout<<endl;
    cout<<"name"<<"  address"<<"  mailcode"<<"  telephone"<<"  email"<<endl;
    for(int i=0;i<number;i++)
    {   
        string Name,Address,Mailcode,Telephone,Email;
        cout<<"please input NO."<<i+1<<" 's data:"<<endl;
        cin>>Name>>Address>>Mailcode>>Telephone>>Email;
          Touch *ptouch=new Touch;
          if(ptouch==NULL)
          {
              cout<<"Memrory insufficient!"<<endl;
              break;
          }
          ptouch->name=Name;
          ptouch->address=Address;
          ptouch->mailcode=Mailcode;
          ptouch->telephone=Telephone;
          ptouch->email=Email;
        if(head==NULL)
        {
          head=tail=ptouch;
        }
        else
        {
            tail->next=ptouch;
            tail=ptouch;
        }
    }
    return head;
}
void Printtouch(Touch *head)
{
         Touch *p1=head;
         cout<<endl;
         for(p1;p1!=NULL;p1=p1->next)
         {
             cout<<p1->name<<" "<<p1->address<<" "<<p1->mailcode<<" "<<p1->telephone<<" "<<p1->email<<endl;
         } 
}
Touch *deleteTouch(Touch *head,string na)
{
       if(head==NULL)
       {
           cout<<"The list is empty!"<<endl;
           return NULL;
       }
       Touch *p1,*p2;
       p1=head;
       p2=p1->next;
       while(p2!=NULL)
       {
           if(p2->name==na)
           {
               p1->next=p2->next;
               free(p2);
               p2=p1->next;
           }
           else
           {
               p1=p1->next;
               p2=p2->next;
           }
       }
       if(head !=NULL && head->name==na)
       {
           p2=head;
           head=p2->next;
           free(p2);
           return head;
       }
       return head;
}
void Touchfind(Touch *head)
{
    cout<<"请输入您想要查找的姓名:";
    string naa;
    cin>>naa;
    Touch *p3=head;
    while(p3)
    {
        if(p3->name==naa)
        {
            cout<<p3->name<<" "<<p3->address<<" "<<p3->mailcode<<" "<<p3->telephone<<" "<<p3->email<<endl;
            break;
        }
        else
        p3=p3->next;
    }
}
int main()
{
    Touch *head=NULL;
    head=Storetouch();
    Printtouch(head);
    
    Touchfind(head);

    head=deleteTouch(head,"lihua");
    Printtouch(head);

  
}

运行结果如下:

img

img