The STL Map is driving me mad.

Can someone tell me why the following program -
Code: Select all
#include<iostream>
#include<cstring>
#include<map>
using namespace std;
struct ltstr
{
bool operator()(const char *s1, const char *s2) const
{
return (strcmp(s1,s2)<0);
}
};
int main(void)
{
int i;
char buf[100];
map<const char *,int,ltstr> mp;
for(i=0;i<5;i++)
{
cin>>buf;
mp[buf] = i + 1;
}
for(i=0;i<5;i++)
{
cin>>buf;
if(mp.find(buf)!=mp.end())
cout<<mp[buf]<<endl;
}
return 0;
}//end main()
Code: Select all
5
5
5
5
5
Code: Select all
1
2
3
4
5