#include<iostream>#include<cstdlib>usingnamespace std;typedefstructNode{int data;structNode* next;}Node ,* linkList;voidprint(linkList H)//遍历 {if(H -> next){
linkList p;
p = H -> next;while(p !=NULL){
cout << p -> data;if(p -> next !=NULL)
cout <<" ";
p = p -> next;}}}
linkList Creat_L()//头插法 {
linkList H , p;int x;
H =(Node *)malloc(sizeof(Node));
H -> next =NULL;while(cin >> x && x !=-1){
linkList p;
p =(Node *)malloc(sizeof(Node));
p -> data = x;
p -> next = H -> next;
H -> next = p;}return H;}voidFind(linkList H ,int x){int flag =0;
linkList p = H;while(p -> next !=NULL){
linkList q = p -> next;if(q -> data == x){
flag =1;
p -> next = p -> next -> next;free(q);
linkList e;
e =(Node *)malloc(sizeof(Node));
e -> data = x;
e -> next = H -> next;
H -> next = e;}
p = p -> next;}if(flag ==0)
cout <<"False";}intmain(){
linkList A;
cout <<"Please enter your data to be pushed , end with -1"<< endl;
A =Creat_L();print(A);int n;
cin >> n;Find(A , n);print(A);return0;}```