fork(2) download
  1. #include <stdlib.h>
  2. #include <iostream>
  3. #include <map>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. map<int,int> m;
  9. for(int i = 0; i < 1000; ++i)
  10. m[rand()%10]++;
  11. for(auto x: m)
  12. cout << x.first << " : " << x.second << endl;
  13. }
  14.  
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
0 : 107
1 : 95
2 : 99
3 : 97
4 : 97
5 : 89
6 : 100
7 : 106
8 : 104
9 : 106