I would have expected the following code to produce an error:
#include <iostream>
using namespace std;
#include <map>
#include <string>
int main(){
map<string,string> x;
x["10"]=20;
cout <<x["10"]<<endl;
}
because the assigned value is not of type string. However, there is no error. But the output is incorrect -- nothing visible is printed. However, if I enclose 20 in quotes then the output is fine. Can anyone explain