#include<iostream> #include<fstream> #include<cstdio> #include<cmath> #include<string> #include<cstring> #include<string.h> #include<algorithm> #include <cstdlib> using namespace std; struct node { int data; struct node *next; }; void allOut(struct node *input){ while(input != nullptr){ cout << input->data << endl; input = input->next; } } int main(){ struct node *head,*p,*q; head = nullptr; int n; cin >> n; int tem; for(int i = 0;i < n;i++){ p = (struct node *) malloc(sizeof(struct node)); cin >> p->data; p->next = nullptr; if(head == nullptr){ head = p; }else{ q->next = p; } q = p; } allOut(head); }
09-18
2000
07-18
2955
01-06