#includeusing namespace std;struct Node{ Node *next; int elem;};void creatList(Node* &head){ head = new Node; int elem; cin>>elem; head->elem = elem; Node *p = head; while(cin>>elem&&elem) { Node *q = new Node; q->elem = elem; p->next = q; p = p->next; } p->next = NULL;}void printList(Node* &head){ cout< elem<<" "; Node *p = head->next; while(p) { cout< elem<<" "; p = p->next; } cout< elem == x) { p = head; head = head->next; free(p); removeX(head, x); } else removeX(head->next, x);}Node* getElem(Node* head,int i){ int j = 1; Node *p = head; if(head==NULL) return head; while(p&&j next; } return p;}void insertNode(Node* &head,int i,int data){ Node* p = getElem(head, i-1); Node* q = new Node; q->elem = data; q ->next = p ->next; p ->next = q;}void deleteNode(Node* &head,int i){ Node* p = getElem(head, i-1); Node* q = p->next; p->next = q->next; free(q);}void reverseList(Node* &head){ if(head == NULL||head ->next == NULL) return ; Node *pre = head; Node *cur = head->next; Node *nex = NULL; while(cur) { nex = cur -> next; cur ->next = pre; pre = cur; cur = nex; } head->next = NULL; head = pre;}int main(){ Node *p; creatList(p); printList(p); //removeX(p, 4); insertNode(p, 2, 100); printList(p); cout< elem<