fork(2) download
  1. #include <iostream>
  2. #include <vector>
  3. #include <iterator>
  4. #include <numeric>
  5. #include <functional>
  6.  
  7. int main()
  8. {
  9. std::vector<double> v{ 1.0, 2.0, 3.0, 4.0 };
  10.  
  11. std::partial_sum(std::begin(v), std::end(v),
  12. std::begin(v), std::multiplies<double>());
  13.  
  14. std::copy(std::begin(v), std::end(v),
  15. std::ostream_iterator<double>(std::cout, " "));
  16. }
  17.  
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
1 2 6 24