代码:

#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);
}

 

相关文章:

  • 2021-12-02
  • 2021-11-21
  • 2022-03-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-11
  • 2021-11-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-04-27
  • 2022-01-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案