Thread: Multidimentional (more than 2) Maps?

  1. #1
    Registered User
    Join Date
    Dec 2007

    Multidimentional (more than 2) Maps?

    Hey everyone I'm writing a game where the user puts code into a text file and my program reads it in, creates and uses the variables and affects robots on the screen, and so far I've been doing rather well at this...

    My one question is how do you create a map that has 2 dimentions by which to access it.

    To make one its:
    map <string, double> RBT_NUMVALS;
    And I use that by entering the 'variable name' into the map when I call it:

    cout << "x = " << RBT_NUMVALS["x"] << endl;
    I'm trying to make it so that the user can create arrays of 'variables' and thus need to allow for more access than just a string, anyone know how to do that??

    I tried:

    map <string, double, double> RBT_NUMVALS;
    but that didn't seem to work.

    Thanks in advance

  2. #2
    Join Date
    Oct 2007
    Inside my computer
    You can mix 'em together:
    std::map< std::string, std::map<double, std::string> >
    And so on.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Loading maps
    By divineleft in forum C++ Programming
    Replies: 1
    Last Post: 07-05-2006, 10:09 AM
  2. Hash_map, STL maps query
    By alvifarooq in forum C++ Programming
    Replies: 15
    Last Post: 06-07-2005, 09:07 AM
  3. DDX/DDV and Message Maps
    By axr0284 in forum Windows Programming
    Replies: 2
    Last Post: 01-07-2005, 08:55 AM
  4. maps as reference?
    By robquigley in forum C++ Programming
    Replies: 2
    Last Post: 11-26-2003, 09:12 AM
  5. Finding terrain maps...
    By VirtualAce in forum A Brief History of
    Replies: 3
    Last Post: 09-25-2001, 07:44 PM