How can print list link

i have a program about list link, but after input data into a Node, then i can't print data, that i just input. This is my program

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  #include <iostream>

using namespace std;

struct Node {
	int info;
	Node *Next;
};
Node * F;

void DisplayANode(Node *F);
void InsertANode(Node *&F,int x);
int main()
{
	int x;
	
	cout<<"x = ";
	cin>>x;
	InsertANode(F,x);
	DisplayANode(F);
	return 0;
}
void InsertANode(Node *&F,int x)
{
	Node * Temp;
	Temp-> info = x;
	Temp -> Next = F;
	F = Temp ;
}
void DisplayANode(Node *F)
{
	cout<< F->info;
}
closed account (48T7M4Gy)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <iostream>

using namespace std;

struct Node
{
    int info;
    Node *Next;
};

void DisplayANode( Node* );
void InsertANode( Node*, int );

int main()
{
    int x;
    Node* F = new Node;

    cout << "x = ";
    cin >> x;

    InsertANode( F, x );
    DisplayANode( F );
    return 0;
}
void InsertANode( Node* N, int X )
{
    N -> info = X;
}
void DisplayANode( Node* N )
{
    cout << N -> info;
}
Topic archived. No new replies allowed.