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 :: cmath sqrt 
Cpp :: lopping over an array c++ 
Cpp :: format string cpp 
Cpp :: switch in c++ 
Cpp :: static_cast c++ 
Cpp :: getch c++ library 
Cpp :: c++ kruskal algorithm 
Cpp :: optimized bubble sort 
Cpp :: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere. 
Cpp :: read file into vector 
Cpp :: count occurrences of character in string c++ 
Cpp :: how to round a double to 2 decimal places in c++ 
Cpp :: c++ vector sort 
Cpp :: c++ functions 
Cpp :: c++ replace string 
Cpp :: sin in c++ 
Cpp :: c++ cin operator 
Cpp :: c++ length of char array 
Cpp :: how to declare a function in c++ 
Cpp :: return array from function c++ 
Cpp :: c++ typing animation 
Cpp :: c++ foreach 
Cpp :: string in cpp 
Cpp :: iterate vector in reverse c++ 
Cpp :: create a 2d vector in c++ 
Cpp :: run cmd command c++ 
Cpp :: why is using namespace std a bad practice 
Cpp :: c++ lambda 
Cpp :: push local branch to another remote branch 
Cpp :: to lowercase c++ 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =