Quick actions

cmd+k|ctrl+k

Navigation

Languages

map_in_cpp

Snippet info

Language

Cpp

Visibility

public

Author

ganesh26

Created

2020-10-14T11:46:59Z

Updated

2020-10-14T11:46:59Z

#include <iostream>
#include<map>
#include<string>

using namespace std;


// map is an associative array
int main() {
    cout << "Hello World!"<< endl ;
    
    map<string, int > marksmap ;
    
    marksmap["ganesh"] = 100 ;
    marksmap["saurabh"] = 98 ;
    marksmap["rupesh"] = 96 ;
    
    marksmap.insert({{"korumi" , 92} , {"suzuke" , 42}});
    
   
   map<string , int > :: iterator it ;
   
   for(it = marksmap.begin() ; it != marksmap.end() ; ++it)
   {
       cout << (*it).first <<" " <<  (*it).second << endl ;
   }
   
   
   
   

  

    return 0;
}
INFO