I have a map in c++:
#include <bits/stdc++.h>
using namespace std;
int main()
{
map <int,int> map;
int k;
cin >> k;
for (int i = 0; i < k; i++)
{
int m;
cin >> m;
map.at(m)++;
}
}
How can I iterate over this map and add all values of it to vector?
So map look like this:
pair<int, int>(1, 40)
pair<int, int>(22, 30)
pair<int, int>(34, 60)
pair<int, int>(41, 20)
pair<int, int>(5, 50)
pair<int, int>(6, 50)
pair<int, int>(7, 10)
I want to push the values of this to vector. So the vector will look like this: [40, 30, 60, 20, 50, 50, 10]