fork download
  1. #include <iostream>
  2. #include <array>
  3. #include <numeric>
  4. using namespace std;
  5.  
  6. typedef std::array<float,10> float_array;
  7.  
  8.  
  9. void showFloatArray(float_array const& fa)
  10. {
  11. for (auto x : fa)
  12. cout << x << ' ';
  13. cout << endl;
  14. }
  15.  
  16. float_array getFloatArrayOne()
  17. {
  18. float_array res;
  19. std::iota(std::begin(res), std::end(res), 0.0);
  20. return res;
  21. }
  22.  
  23. float_array getFloatArrayTwo()
  24. {
  25. float_array res;
  26. std::iota(std::begin(res), std::end(res), 10.0);
  27. return res;
  28. }
  29.  
  30. int main()
  31. {
  32. float_array f1 = getFloatArrayOne();
  33. float_array f2 = getFloatArrayTwo();
  34. showFloatArray(f1);
  35. showFloatArray(f2);
  36. }
Success #stdin #stdout 0s 3344KB
stdin
Standard input is empty
stdout
0 1 2 3 4 5 6 7 8 9 
10 11 12 13 14 15 16 17 18 19