fork download
  1. #include <iostream>
  2. #include <functional>
  3. #include <iterator>
  4. #include <numeric>
  5. using namespace std;
  6.  
  7. int main() {
  8. accumulate(istream_iterator<double>(cin), istream_iterator<double>(), 0, [](int a, int b) -> auto { return a ? (cout<<(a + b)/2.0<<endl, 0) : b;});
  9. return 0;
  10. }
Success #stdin #stdout 0s 3460KB
stdin
1 2
3 4
5 6
7 8
10.0 2.0
stdout
1.5
3.5
5.5
7.5
6