why is my linked list printing out backwards?
Code:#include <iostream.h>
#include <stdlib.h>
using namespace std;
typedef struct node
{
int a;
node *next;
}NODE;
int main()
{
NODE *current = NULL;
for (int i = 0; i < 5; i++)
{
node *newnode = new node;
cout << "input a value: ";
cin >> newnode->a;
newnode->next = current;
current = newnode;
}
node *show = current;
while (show != NULL)
{
cout << show->a << endl;
show = show->next;
}
system("PAUSE");
return 0;
}