#include <iostream>
#include <fstream>
#include <stdio.h>
#include <cstdlib>
using namespace std ;
struct Node{
int value ;
struct Node *next ;
} ;
int main(){
struct Node *first = NULL ;
struct Node *p ;
int n ;
for (;;) {
cin >> n;
if (!n){
break;
}
p = new struct Node;
p->value = n;
p->next = first ;
first = p;
}
p = first;
while (p) {
cout << p->value << " " ;
p = p->next;
}
return 0 ;
}
Почему вывод задом наперед? Заранее благодарен.