You can achieve this like following :
map<string, int>::iterator it; for (it = symbolTable.begin(); it != symbolTable.end(); it++) { std::cout << it->first // string (key) << ':' << it->second // string's value << std::endl; }
With C++11 ( and onwards ),
for (auto const& x : symbolTable) { std::cout << x.first // string (key) << ':' << x.second // string's value << std::endl; }
With C++17 ( and onwards ),
for (auto const& [key, val] : symbolTable) { std::cout << key // string (key) << ':' << val // string's value << std::endl; }
Related Posts:
- How to find if a given key exists in a C++ std::map
- How can I print out C++ map values?
- I’m getting Key error in python
- How do I merge dictionaries together in Python?
- Simple dictionary in C++
- When is del useful in Python?
- What is C# equivalent of
- Angular map. What is it?
- Map like structure in C: use int and struct to determine a value
- Python – How to fix “ValueError: not enough values to unpack (expected 2, got 1)”
- Dictionary text file
- How do I efficiently iterate over each entry in a Java Map?
- How to sort Map values by key in Java?
- What is the difference between the HashMap and Map objects in Java?
- How can you print a variable name in python? [duplicate]
- Python AttributeError: ‘dict’ object has no attribute ‘append’
- How exactly do lookup tables work and how to implement them?
- Why are there no hashtables in the C standard library?
- Map vs Object in JavaScript
- How to iterate (keys, values) in JavaScript?
- lvalue required as left operand of assignment error when using C++
- g++ ld: symbol(s) not found for architecture x86_64
- Making my own toString() method on c++ struct
- Struct Constructor in C++?
- What is meant with “const” at end of function declaration? [duplicate]
- What’s the C++ version of Java’s ArrayList
- C++ Error: ISO C++ Forbids Comparison Between Pointer and Integer [-fpermissive]
- What are forward declarations in C++?
- Does a Java to C++ converter/tool exist?
- How to write C++ on Mac?
- C++ string to double conversion
- C++ Linked List Node with class
- ‘was not declared in this scope’ error
- Why use string::iterator rather than index?
- C++ request for member ‘’ in ‘’, which is of non-class type ‘’
- Using O_RDWR vs O_RDONLY | O_WRONLY
- How to implement the factory method pattern in C++ correctly
- c++ array – expression must have a constant value
- getline() does not work if used after some inputs
- Passing a 2D array to a C++ function
- ‘typeid’ versus ‘typeof’ in C++
- Fatal error: iostream: No such file or directory in compiling C program using GCC
- Thread pooling in C++11
- Callback functions in C++
- What is ‘\0’ in C++?
- Generate random float between two floats
- What is std::move(), and when should it be used?
- How can I get list of values from dict?
- Undefined reference to class constructor, including .cpp file fixes
- Deleting a dynamically allocated 2D array
- How to add element to C++ array?
- Difference of keywords ‘typename’ and ‘class’ in templates?
- Quick Way to Implement Dictionary in C
- Error: Jump to case label in switch statement
- What does int & mean
- Split a string into an array in C++
- Invalid conversion from “const char*” to “char” error [duplicate]
- Initializing a static std::map
in C++ - C++ strings and pointers
- delete vs delete[] operators in C++
- What is the preferred way to include error messages in C++?
- How to Convert a C++ String to Uppercase
- C++ Fractions Class
- #pragma once vs include guards?
- Debug vs Release in CMake
- C++ Initializing a Global Array
- How to convert an ASCII char to its ASCII int value?
- Warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11?
- C++ – pointer being freed was not allocated error
- Reference to non-static member function must be called
- Call to non-static member function without an object argument compiler error
- C++ compile time error: expected identifier before numeric constant
- How can I assign an array from an initializer list?
- I get this error: “glibc detected”
- Python Add to dictionary loop
- How can I get and use the header file
in my C++ program? - cin.eof() functionality
- Implementing a tree in C++
- Drawing Circle with OpenGL
- AttributeError: ‘str’ object has no attribute ‘items’
- Run-Time Check Failure #2 – Stack around the variable ‘foo’ was corrupted
- Converting string to ASCII
- got “cannot appear in a constant-expression” when using template
- C++ ostream and ofstream conversions
- C++ discards qualifiers
- What is the source of the data for the ProgramFiles, ProgramW6432Dir, ProgramFilesDir (x86), CommonProgramFiles environment variables?
- C++ : Exception occurred in script: basic_string::_S_construct NULL not valid
- Error: “expected primary-expression before int”
- C++ Error: Expected a type specifier
- Where to declare/define class scope constants in C++?
- Friend methods error
- Does WPF Work with C++?
- Multiple inputs on one line
- When to use a Map instead of a List in Java?
- Why do I get: -9223372036854775808
- Compiler error C4430: missing type specifier – int assumed [duplicate]
- ‘&’ : illegal operation on bound member function expression [duplicate]
- Multiple definitions of “Main”
- C# Dictionary get item by index
- Getting the error floating point exception: 8