rt,代码不输出,干等在那
#include<iostream>
using namespace std;
struct node{
int val;
node* next;
node(int x){
val=x;
next=NULL;
}
};
int main(){
int n;
cin>>n;
node* head=new node(n);
node* p=head;
while(cin>>n){
node* q=new node(n);
p->next=q;
p=p->next;
}
node* m=head;
while(m!=nullptr){
cout<<m->val<<" ";
m=m->next;
}
return 0;
}
刚回头开始啃指针qwq