Search
 
SCRIPT & CODE EXAMPLE
 

CPP

declare dictionary cpp

#include <map>

std::map<char, char> my_map = {
    { 'A', '1' },
    { 'B', '2' },
    { 'C', '3' }
};
Comment

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;
Comment

PREVIOUS NEXT
Code Example
Cpp :: pairs 
Cpp :: cpp iterate words from string 
Cpp :: C++ Fahrenheit to Kelvin 
Cpp :: tostring c++ 
Cpp :: cout hex value 
Cpp :: penjanje 
Cpp :: qt qmessagebox 
Cpp :: set cmd size c++ 
Cpp :: c++ replace character in string 
Cpp :: taking user input for a vector in c++ 
Cpp :: print queue c++ 
Cpp :: cannot find -lsqlite3 C++ compiler error 
Cpp :: std cout c++ 
Cpp :: PI IN C++ WITH CMATH 
Cpp :: winmain example 
Cpp :: c++ loop pyramid 
Cpp :: retu7rn this c++ 
Cpp :: default access modifier in c++ in struct 
Cpp :: 2d array using vector 
Cpp :: dynamically generating 2d array in cpp 
Cpp :: c++ lock 
Cpp :: pow in c++ 
Cpp :: c++ program to take input from user 
Cpp :: how to add colored text in c++ 
Cpp :: sort using lambda c++ 
Cpp :: What should main() return in C++? 
Cpp :: how to check if a number is prime c++ 
Cpp :: vector fin element c++ 
Cpp :: c++ get type name 
Cpp :: double to int c++ 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =