cpp map operator[] code example
Example 1: map in cpp
#include <map>
// empty map container
map<int, int> gquiz1;
// insert elements in random order
gquiz1.insert(pair<int, int>(1, 40));
Example 2: map in cpp
#include <map>
int main(){
//new map
std::map <int,int> myMap;
myMap[0] = 1;
myMap[1] = 2;
myMap[2] = 3;
myMap[3] = 4;
}