万金流
以码会友。 吾Q:578751655。 水平有限,轻喷,谢!

代码:

#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;
struct Node
{
    int v;
    Node *next;
};
main()
{
    int n;
    Node *a=new Node,*b;
    cin>>n;
    b=a;
    cin>>a->v;
    a->next=NULL;
    for(int i=2;i<=n;i++)
    {
        a->next=new Node;
        a=a->next;
        cin>>a->v;
        a->next=NULL;
    }
    a=b;
    do
    {
        cout<<a->v<<endl;
        a=a->next;
    }
    while(a!=NULL);
}

 

posted on 2019-08-23 14:45  万金流  阅读(668)  评论(0)    收藏  举报