Answers for "declare dictionary cpp"

C++
3

create a dictionary cpp

// The equivalent to python dictionaries are maps in c++
  map<int, char> mymap; // Enter required types and name
  mymap[1] = 'a';
  mymap[4] = 'b';
  cout << "my map is -" << mymap[1] << " " < <mymap[4] << endl;
Posted by: Guest on February-26-2020
2

declare dictionary cpp

#include <map>

std::map<char, char> my_map = {
    { 'A', '1' },
    { 'B', '2' },
    { 'C', '3' }
};
Posted by: Guest on October-02-2021

Browse Popular Code Answers by Language