#include
#include
#include
#include
using std::cout;
using std::endl;
using std::istream_iterator;
using std::istringstream;
using std::string;
template
double mySum(Iter begin, Iter end) {
double sum = 0.0;
for( ; begin != end ;)
sum += *begin++;
return sum;
}
int main() {
char* stock_ticker = "4.5 6.75 8.25 7.5 5.75";
istringstream ticker(stock_ticker);
istream_iterator begin(ticker);
istream_iterator end;
cout << stock_ticker << endl ;
cout << mySum (begin, end) << endl;
return 0;
}
/*
4.5 6.75 8.25 7.5 5.75
32.75
*/