链表
2023-08-26 10:35:18
发布于:浙江
#include <bits/stdc++.h>
using namespace std;
struct node{
char data;
node *next;
};
int main(){
node *head,*r;
head = new node;
head->next =NULL;
r=head;
node *p;
for(int i=0;i<5;i++){
p=new node ;
p->data='A'+i;
p->next=NULL;
r->next=p;
r=p;
}
r->next = head->next;
for(int j=1;j<=4;j++){
for(int i=1;i<=2;i++){
p=p->next;
}
p->next=p->next->next;
}
cout<<p->data;
return 0;
}
这里空空如也
有帮助,赞一个