-
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.
-
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.
-
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;
}