#include <iostream>
#include <stdio.h>
using namespace std;
//typedef char DataType;
struct Node{
char data;
int jishu;
Node *next;
};
//typedef Node *LinkList;
int main()
{
Node *head=NULL;
head=new(Node);
char c;
cin>>c;
head->data=c;
Node *p=head;
int i=2;
while(c=getchar(),c!='\n'){
p->next=new(Node);
p=p->next;
p->data=c;
p->jishu=i;
p->next=NULL;
i++;
}
Node *q=head;
Node *m=NULL;
while(q!=NULL){
if(q->next->data=='w'){
m=q->next;//这里一定要想清楚,容易出错的地方
<q->next=m->next;//这里一定要想清楚,容易出错的地方
break;
}
else{
q=q->next;
}
}
Node *n=head;
while(n!=NULL){
cout<<n->data;
n=n->next;
}
cout<<endl;
return 0;
}
链表结点的删除
最新推荐文章于 2022-03-17 22:08:45 发布