fork(2) download
  1. #include <iostream>
  2. #include <sstream>
  3. #include <string>
  4.  
  5. int main()
  6. {
  7. std::istringstream iss("2.832 1.3067 nana1.678 x-1E2 xxx.05 meh.ugh");
  8. double num = 0;
  9. for (; iss; )
  10. if (iss >> num)
  11. std::cout << num << '\n';
  12. else if (!iss.eof())
  13. {
  14. iss.clear();
  15. iss.ignore(1);
  16. }
  17. }
Success #stdin #stdout 0s 3272KB
stdin
Standard input is empty
stdout
2.832
1.3067
1.678
-100
0.05