fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <iterator>
  4. #include <cstdlib>
  5. #include <ctime>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. int m[49];
  11. srand(time(nullptr));
  12. generate(begin(m), end(m), [](){ return rand()%30; });
  13.  
  14. copy(begin(m), end(m), ostream_iterator<decltype(m[0])>(cout, " "));
  15. cout << endl << count(begin(m), end(m), 5);
  16. }
  17.  
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
21 3 3 21 18 6 19 1 6 1 3 11 4 1 29 23 5 22 21 4 24 14 3 15 23 18 14 29 4 22 15 17 25 18 0 13 24 19 7 1 21 10 4 17 3 26 10 8 18 
1