RT:
#include < iostream >
#include < sstream >
#include < string >
#include < iterator >
#include < numeric>
using std::cout;
using std::cin;
using std::endl;
using std::string;
using std::istringstream;
using std::istream_iterator;
void _tmain(int argc, _TCHAR* argv[])
{
string data("2.4 2.5 3.6 2.1 6.7 6.8 94 95 1.1 1.4 32");
istringstream input(data);
istream_iterator < double > begin(input), end;
cout << "The sum of the values from the data string is "<< std::accumulate(begin, end, 0.0) << endl;
}
巧用stream