Horje
Traversing a map Code Example
Traversing a map
int arr[] = { 1, 1, 2, 1,  3, 1, 4, 3 };
map<int, int> m;
for (auto i: arr)
	m[arr[i]]++;
cout << "Element  Frequency" << endl;
for (auto& [k,v] : m) // Since c++17
	cout << k << "   " << v << endl;




Cpp

Related
C++ generate a random letter Code Example C++ generate a random letter Code Example
how to check a number in string Code Example how to check a number in string Code Example
integer to char c++ Code Example integer to char c++ Code Example
Visual studio code include path not working c++ Code Example Visual studio code include path not working c++ Code Example
cpp get last element of vector Code Example cpp get last element of vector Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9