fork download
  1. #include <iostream>
  2. #include <sstream>
  3. using namespace std;
  4.  
  5. int main() {
  6. string Str = " 123 5 77 20";
  7. int Number, Sum;
  8.  
  9. stringstream StrOut = stringstream (Str, ios::in);
  10. while(!StrOut.eof())
  11. {
  12. StrOut >> Number;
  13. Sum += Number;
  14.  
  15. }
  16. cout << Sum << "\n";
  17. }
  18.  
Success #stdin #stdout 0.01s 5280KB
stdin
10 2 3
stdout
225