Please Help With Random Number Generate Queue Pointer

I Am Slowly Learning To Understanding Queue Pointer, But I've Gotten So Lost While Implementing This Program:

The Program I Was Thinking Was To Generate 10 Random Numbers From 1~20 To Display In This Queue Linked List, But The Senses In My Mind Got Completely Lost.

Can Somebody Help Me How To Display Those Generated Random Numbers Please?

This Is What I've Gotten So Far From Top Of My Current Knowledge >.<

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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
 #include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
template <class T>
class queuepk
{
private: struct node
		 {
			 T info;
			 node *next;
		 };
		 node *front, *rear;
public: queuepk()
		{
			front = NULL; rear = NULL;
		}
		void clearQueue ()
		{
			node *q; q = front;
			while (front != NULL)
			{
				q=front;
				front = front ->next;
				delete(q);
			}
		}
		//add a node at the rear of the queue
		void pushq(T x)
		{
			node *q;
			q = new (node); q->info = x; q->next=NULL;
			if (front == NULL)
			{
				front = q ; rear = q;
			}
			else
			{
				rear->next = q; rear = q;
			}
		}
		//test whether queue is empty or not
		bool Emptyq()
		{
			if(front == NULL)
				return true;
			else
				return false;
		}
		//pop the first node
		T popq()
		{
			node *q = front; T x;
			x = front->info;
			front = front->next;
			delete (q);
			return x;
		}
		void displayq()
		{
			node *r=front;
			while( r != NULL )
			{
				cout<<r->info<<"  ";
				r=r->next;
			}
		}
};
int main()
{
	queuepk<int> q;
	int n;
	srand(time (0));
	cout<<"This is The list: ";
	for (int i = 0; i<10; ++i)
	{
		n = rand()%19+1;
	}

	cout<<"\n";
	//Terminate
	system("pause");
	return 0;
}
Topic archived. No new replies allowed.