#include
using namespace std;
struct node{
int x;
struct node *next;
node(){
x=0;next=NULL;
}
};
int main(){
int i,j,k,m,n;
node *h,*p,*q;
h=new node;
cin>>n;
for(i=1;i<=n;i++){
cin>>k;
q=new node;
q->x=k;
p=h;
while(p->next!=NULL&&p->next->x
next;
if(p->next==NULL)p->next=q;
else{
q->next=p->next;
p->next=q;
}
}
p=h->next;
while(p!=NULL){
cout<
x<<" ";
p=p->next;
}
return 0;
}
这虽然有点麻烦,但对于学结构体还是有帮助的
因篇幅问题不能全部显示,请点此查看更多更全内容