Yay! It works! Now comes the more creative part, the descriptions ("This is the room 2, 0" just doesn't cut it).
And the nested brackets don't bother me if they don't bother the compiler. In a...
Type: Posts; User: Slavakion
Yay! It works! Now comes the more creative part, the descriptions ("This is the room 2, 0" just doesn't cut it).
And the nested brackets don't bother me if they don't bother the compiler. In a...
I definitely can't just write
cout << rooms["a40"]
because it's dependant on a variable. I'm looking to base the movement on x y coordinates and tie that to the array. So when you move, the...
Okay, I cleaned it up a lot (less globals!). Now, I need to know how to display a value of an object in the map by using the key. My book doesn't really get into maps at all...
EDIT: BTW, Yeah, it...
#include <iostream>
#include <stdlib.h>
#include <map>
#include <string>
using namespace std;
// Globals //
int x; //x coordinate for map
Okay, I tried using the map variable/whatever. It doesn't compile.
map<string, string> rooms;
rooms["a00"] = "This is the room 0,0\n";
rooms["a01"] = "This is the room 0,1\n";
rooms["a03"] =...
Thanks. I'll try using the map thingy (command/function). Who would've thought -- using 'map' for a map? :)
I'm trying to create a two-dimensional array of pointers but I don't know how to initialize it.
What I'm trying to do overall is create a text-based adventure game (like Zork). The pointers point...
Thanks, everyone. (And sorry about not replying until now ;) )
To clarify the title, I want to know how to work past the fact that whitespaces are read as delimiters. So when the name "John Smith" is entered into
string name;
cin >> name;
The string...
Ok, the == was what I was missing. Thank you.
What I want is to be able to take the user input with cin and store it in a string. Then, by using a function, check to see if the string matches something.
To clarify
string input;
cin...