fork(6) 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. char ignored;
  10. while (iss >> num && std::cout << num << '\n' ||
  11. (iss.clear(), iss) >> ignored)
  12. ;
  13. }
Success #stdin #stdout 0s 3272KB
stdin
Standard input is empty
stdout
2.832
1.3067
1.678
-100
0.05