declare dictionary cpp

Solutions on MaxInterview for declare dictionary cpp by the best coders in the world

showing results for - "declare dictionary cpp"
Perrine
07 Jul 2020
1  // The equivalent to python dictionaries are maps in c++
2  map<int, char> mymap; // Enter required types and name
3  mymap[1] = 'a';
4  mymap[4] = 'b';
5  cout << "my map is -" << mymap[1] << " " < <mymap[4] << endl;
Angelo
26 Nov 2018
1#include <map>
2
3std::map<char, char> my_map = {
4    { 'A', '1' },
5    { 'B', '2' },
6    { 'C', '3' }
7};