Thread: how do i use maps?

  1. #1
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    University of Waterloo

    how do i use maps?

    looked around, didn't see any tutorials or whatnot, so now i'm asking you guys......

    how do you use the map variable? do i HAVE to have the namespace thing? I need to know EXACTLY what I need for them, will they work with visual studio? what library file do i need? which header files? etc....

    thanks in advance.

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    you will find tutorials on the web but the best place to learn STL is from a book and the best book is The c++ standard library by nicolai jossutis.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :-

  3. #3
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Ontario, Canada
    Here's a quick example:

    #include <iostream>
    #include <map>
    #include <string>
    #include <cmath> // For atan( )
    using namespace std;
    int main( void ) {
    	map< string, double > theMap;
    	theMap[ "pi" ] = 4 * atan( 1 );
    	cout<<"pi="<<theMap[ "pi" ]<<endl;
    	return 0;
    Last edited by XSquared; 03-15-2003 at 02:15 PM.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

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