AJTAMjid2000

Map begging

Jun 9th, 2021 (edited)
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <bits\stdc++.h>
  2. using namespace std;
  3.  
  4. int main (){
  5.   map<string,int> mp;
  6.  
  7.  
  8.   mp["Sadia"]=10;
  9.   mp["Sanjida"]=20;
  10.   mp["Susmita"]=30;
  11.   mp["Sagor"]=40;
  12.   mp.insert(make_pair("Sadia",10));// we can also call like this
  13.  
  14.    map<string, int>::iterator it;
  15.    for(it=mp.begin(); it!=mp.end(); ++it){
  16.       cout << it->first <<" = "<<it->second<< '\n';
  17.    }
  18.  
  19.   return 0;
  20. }
  21.  
Add Comment
Please, Sign In to add comment