Instruction and Guidance needed

Okay, so I got the gist of an array, but when it comes to vectors I'm kinda clueless... well... not kinda, I'm a nOOb... Anyhow,I wanna change rooms, dirs, verbs and nouns into a vector... I've been playing around with it to change it but I keep getting hit with an undeclared identifier then told to refer to my declarations of rooms, dirs, verbs and nouns.

So this is what I got so far, without showing all the nonsense

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
#include <iostream>
#include <string>
#include <vector>
#include <cctype>

using namespace std;

enum en_DIRS {NORTH, EAST, SOUTH, WEST};
enum en_ROOMS {KITCHEN, DARKROOM, CARPARK, LOBBY, RESTAURANT, CORRIDOR, STOREROOM, POOL, GARDEN, COURTYARD,
MASTERCHAMBER};
enum en_VERBS {GET, DROP, USE, OPEN, CLOSE, EXAMINE, INVENTORY, LOOK};
enum en_NOUNS {STORE_DOOR, MAGNET, METER, ROULETTE, MONEY, FISHROD};

const int NONE = -1;
const int DIRS = 4;
const int ROOMS = 11;
const int VERBS = 8;
const int NOUNS = 6;

class Words
{
	public:
		string word;
		int code;
};

class Room
{
	public:
		string description;
		int exits_to_room[DIRS];
};

class Noun
{
	public:
		string word;
		string description;
		int code;
		int location;
		bool can_carry;
};

void set_rooms(Room *rms);
void set_directions(Words *dir);
void set_verbs(Words *vbs);
void set_nouns(Noun *nns);



and of course what I want to change to a vector... Kinda losing my mind with this, figured I'd ask for a bit of instruction.

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
int main()
	{
		string command;
		string word_1;
		string word_2;

		Room rooms[ROOMS];
		set_rooms(rooms);

		Words directions[DIRS];
		set_directions(directions);

		Words verbs[VERBS];
		set_verbs(verbs);

		Noun nouns[NOUNS];
		set_nouns(nouns);

		int location = CARPARK;

		while(word_1 != "QUIT")
			{
				command. clear();
				cout << "What shall I do? ";
				getline(cin, command);

				word_1.clear ();
				word_2.clear ();

				section_command(command, word_1, word_2);

				if(word_1 != "QUIT")
					{
						parser(location, word_1, word_2, directions, verbs, rooms, nouns);
					}
			}
		return 0;
	}


Any help would be awesome, Thanks!! :)
> but when it comes to vectors I'm kinda clueless...

Read this tutorial: http://www.mochima.com/tutorials/vectors.html

And then, this one: http://www.mochima.com/tutorials/STL.html
Thanks, that was good help (broke it down barney style haha)... Actually managed to put ROOMS into a vector, though everything compiled without error, the application crashes... I'm sure it's something funky that will stand out.... Thanks again :)
Topic archived. No new replies allowed.