#include #include using namespace std; typedef int elemtype; typedef struct LNode { elemtype data; struct LNode *next; }LNode,*Linklist; void creatlist(Linklist &L,elemtype A[],int n) { L=NULL; int i; for(i=n-1;i>=0;i--) { LNode *p=new LNode; p->data=A[i]; p->next=L; L=p; } } void xianshi(Linklist L) { LNode *p=L; while(p) { cout<data<next; } } void reverse(Linklist &L) { LNode *p=L; L=NULL; while(p) { LNode *s; s=p; p=p->next; s->next=L; L=s; } } int main() { int n,i; int a[100]; Linklist L; while(scanf("%d",&n)!=EOF) { for(i=0;i>a[i]; creatlist(L,a,n); xianshi(L); cout<
转载于:https://www.cnblogs.com/NYNU-ACM/p/4236865.html