My program is written in C++.
#include <iostream> #include <string> #include <map> using namespace std; class Details { int x; int y; }; typedef std::map<string, Details> Det; Det det; Details::Details(int p, int c) { x = p; y = c; } int main(){ det.clear(); insertNew("test", 1, 2); cout << det["test"] << endl; return 0; } I want to print the value of a key with the simplest way. Eg det["test"] fails to compile. How to I print values (1,2) for (x,y) that correspond to key "test"?