Search:

Type: Posts; User: Slavakion

Search: Search took 0.01 seconds.

  1. Replies
    12
    Views
    2,741

    Yay! It works! Now comes the more creative part,...

    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...
  2. Replies
    12
    Views
    2,741

    I definitely can't just write cout

    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...
  3. Replies
    12
    Views
    2,741

    Okay, I cleaned it up a lot (less globals!). Now,...

    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...
  4. Replies
    12
    Views
    2,741

    #include #include ...

    #include <iostream>
    #include <stdlib.h>
    #include <map>
    #include <string>

    using namespace std;

    // Globals //

    int x; //x coordinate for map
  5. Replies
    12
    Views
    2,741

    Okay, I tried using the map variable/whatever. It...

    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"] =...
  6. Replies
    12
    Views
    2,741

    Thanks. I'll try using the map thingy...

    Thanks. I'll try using the map thingy (command/function). Who would've thought -- using 'map' for a map? :)
  7. Replies
    12
    Views
    2,741

    2D Array of Pointers

    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...
  8. Replies
    18
    Views
    3,846

    Thanks, everyone. (And sorry about not replying...

    Thanks, everyone. (And sorry about not replying until now ;) )
  9. Replies
    18
    Views
    3,846

    Using cin to read a name into 1 string

    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...
  10. Replies
    3
    Views
    1,806

    Ok, the == was what I was missing. Thank you.

    Ok, the == was what I was missing. Thank you.
  11. Replies
    3
    Views
    1,806

    Comparing string contents

    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...
Results 1 to 11 of 11