Making a text based game using a Queue List.

This is a recent queue list I made in class. I was wondering how I would make a game out of this. I know you guys are probably saying that if I made this code then I would find out how to make a simple text game. Well, I do know what I want to make, the problem is I am getting frustrated on how I would make a menu game that would ask the user to input the number of items they want, display random items, ask if they would like to delete an item, if not then ask them if they would like to play again.

I would be greatly appreciated if someone could help me out. I need something by tomorrow. Thanks.

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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#include <iostream>
using namespace std;

struct nodeType
{
	int info;
	nodeType* link;
};

nodeType* head;
nodeType* current;
nodeType* newNode;

int size;

void createNode(nodeType* &);
void pushLink(nodeType* &, nodeType* &, nodeType* &);
void popLink(nodeType* &, nodeType* &);
void fillL(nodeType* &, nodeType* &, nodeType* &, int p);
void outputList(nodeType* &, nodeType* &);

int main()
{
	cout << "Enter size for the data structures: ";
	cin >> size;

	cout << "---------------------------------------------------" << endl << endl;
	cout << "The Linked List: " << endl;
	cout << "---------------------------------------------------" << endl << endl;
	fillL(head, current, newNode, size+1);
	outputList(head, current);
	cout << "---------------------------------------------------" << endl << endl;

	cout << "Pushing the List: " << endl;
	cout << "---------------------------------------------------" << endl << endl;
	pushLink(head, current, newNode);

	cout << "Popping the List: " << endl;
	cout << "---------------------------------------------------" << endl << endl;
	popLink(head, current);


	return 0;
}

void createNode(nodeType* &n)
{
	n = new nodeType;
	n->info = rand()%500;
	n->link = NULL;
};

void pushLink(nodeType* &h, nodeType* &c, nodeType* &n)
{
	createNode(n);

	c = h;

	while(c->link != NULL)
		c = c->link;

	c->link = n;
	n = NULL;
	c = h;
	outputList(h, c);
	cout << "---------------------------------------------------" << endl << endl;
};

void popLink(nodeType* &h, nodeType* &c)
{
	c = h;
	h = h->link;
	delete c;
	c = h;
	outputList(h, c);
	cout << "---------------------------------------------------" << endl << endl;
};

void fillL(nodeType* &h, nodeType* &c, nodeType* &n, int p)
{
	while(p > 0)
	{
		createNode(n);
		if(h == NULL)
		{
			h = n;
			c = n;
		}

		else
		{
			while(c->link != NULL)
				c = c->link;
			c->link = n;
			c = h;
		}
		n = NULL;
		p--;
	}
};
void outputList(nodeType* &h, nodeType* &c)
{
	while(c->link != NULL)
	{
		cout << "info : " << c->info << endl;
		c = c->link;
	}
};
Topic archived. No new replies allowed.