Hi,
I'm trying to use a very simple sample from a Herbert Schildt's book using the stl's map, but it doesnt work. Im using MSDeV Studio 6 and when I compile it gives a lot of hieroglific warnings. Is it something to do with the Micrososft implemetation of STL?
The sample is:
#include <iostream>
#include <map>
using namespace std;
int main()
{
map<char, int> m;
int i;
for(i = 0; i <26 ; i++)
m.insert(pair<char,int('A'+i,65+i));
char ch;
cout << "Enter key: ";
cin >> ch;
map<char, int>::iterator p;
p = m.find(ch);
if (p != m.end())
cout << "Its ASCII value is " << p->second;
else
cout << "key not in map.\n";
return 0;
}
>> Micrososft implemetation of STL?
Sometimes this is the problem, but rarely. More likely itis a mistake in your code.
>> m.insert(pair<char,int('A'
There is no ">" at the end of the "pair<"
If that doesn't fix the problem, lost the error messages you are getting.