#include<stdio.h>
#include<iostream>
#include<iterator>
#include<map>
using namespace std;
int main()
{
map <string,int> m;
map <string, int> :: iterator it;
m["Anik"] = 43;
m["Sourav"] = 44;
m["Soad"] = 45;
m["Shawon"] = 46;
m.insert(make_pair("Anik Das", 75));
printf("%d ", m["Anik Das"]);
it = m.begin();
cout << it ->first << " " << it ->second << endl << endl;
for(it=m.begin();it != m.end();it++)
{
cout << it ->first << "------>" << it ->second << endl;
}
cout << endl;
return 0;
}
#include<iostream>
#include<iterator>
#include<map>
using namespace std;
int main()
{
map <string,int> m;
map <string, int> :: iterator it;
m["Anik"] = 43;
m["Sourav"] = 44;
m["Soad"] = 45;
m["Shawon"] = 46;
m.insert(make_pair("Anik Das", 75));
printf("%d ", m["Anik Das"]);
it = m.begin();
cout << it ->first << " " << it ->second << endl << endl;
for(it=m.begin();it != m.end();it++)
{
cout << it ->first << "------>" << it ->second << endl;
}
cout << endl;
return 0;
}
Comments
Post a Comment