Skip to content

Instantly share code, notes, and snippets.

@qikcik
Created May 18, 2020 14:32
Show Gist options
  • Save qikcik/daba61ebf515c7678ff85c1d448ae667 to your computer and use it in GitHub Desktop.
Save qikcik/daba61ebf515c7678ff85c1d448ae667 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <map>
#include <array>
int main() {
std::array<int,7> inArray = {2,3,4,4,5,2,4};
std::map<int,int> sumElements;
for(auto& element : inArray)
sumElements[element]++;
for(auto& [key, value] : sumElements)
std::cout << key << " wystapil: " << value << std::endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment