how do i use maps?

This is a discussion on how do i use maps? within the C++ Programming forums, part of the General Programming Boards category; looked around, didn't see any tutorials or whatnot, so now i'm asking you guys...... how do you use the map ...

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

    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
    Posts
    2,572
    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 :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

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

    Code:
    #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, 11:09 AM
  2. Hash_map, STL maps query
    By alvifarooq in forum C++ Programming
    Replies: 15
    Last Post: 06-07-2005, 10: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 Cprogramming.com
    Replies: 3
    Last Post: 09-25-2001, 08:44 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21