fork download
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <algorithm>
  4. #include <vector>
  5. #include <iterator>
  6. int f() { return rand(); }
  7. int main()
  8. {
  9. std::vector<int> v(10);
  10. transform(v.begin(), v.end(), v.begin(), [](int){return f();});
  11. copy(v.begin(), v.end(), std::ostream_iterator<int>(std::cout, " "));
  12. std::cout << '\n';
  13. }
  14.  
Success #stdin #stdout 0s 2960KB
stdin
Standard input is empty
stdout
1804289383 846930886 1681692777 1714636915 1957747793 424238335 719885386 1649760492 596516649 1189641421