#include #include #include using namespace std; class grades{ public: int e1, e2, e3; grades():e1(0),e2(0),e3(0){} grades(int o,int t,int h):e1(o),e2(t),e3(h){} void print(){ cout << e1 << " " << e2 << " " << e3 << endl; } }; void main(){ map studi; grades g1(10,50,75); studi["Ken Moore"] = g1; grades g2(80,90,90); studi["Ray"] = g2; studi["Ray"].print(); studi["Ken Moore"].print(); grades g3(98,98,98); pair p1("Adam",g3); studi.insert(p1); studi["Adam"].print(); grades g4(99,99,99); pair p2("Earl",g4); studi.insert(p2); // find returns an iterator that points to a pair (or end()) // dereferencing find will yield a pair // could have been studi["Earl"].print() (*studi.find("Earl")).second.print(); }