#include
#include
using std::cout;
using std::endl;
using std::cin;
using std::istream_iterator;
template
double mySum (Iter begin, Iter end) {
double sum = 0.0;
for( ; begin != end ;)
sum += *begin++;
return sum;
}
int main() {
cout << "Ctrl-Z to stop" << endl;
double av = mySum(istream_iterator(cin), istream_iterator());
cout << "The sum value is " << av << endl;
return 0;
}
/*
Ctrl-Z to stop
^Z
The sum value is 0
*/