• Source
    1. #include<iostream>
    2. #include<string>
    3. #include<map>
    4. #include<iterator>
    5.  
    6. using namespace std;
    7.  
    8. int main()
    9. {
    10. map<int, string> Employees;
    11.  
    12. Employees[5234] = "Ashis";
    13. Employees[3374] = "Chenmoy";
    14. Employees[1923] = "Jiban";
    15. Employees[7582] = "Sujan";
    16. Employees[5328] = "Rony";
    17.  
    18. cout << "Employees[3374]= " << Employees[3374] << endl << endl;
    19. cout << "Map size: " << Employees.size() << endl;
    20.  
    21.  
    22. map<int, string>::iterator i; // You will see all data in Sort
    23. for( i = Employees.begin (); i!=Employees.end(); ++i)
    24. {
    25. cout << (*i).first << ": " << (*i).second << endl;
    26. }
    27.  
    28. printf("\n\t\t*** Thanks ...\n");
    29. getchar();
    30. return 0;
    31. }