fork download
  1.  
  2. #include <iostream>
  3. #include <string>
  4. #include <sstream>
  5.  
  6. int main() {
  7.  
  8. using namespace std;
  9.  
  10. std::istringstream iss("0");
  11. double d;
  12.  
  13. if (iss >> d)
  14. {
  15. cout << "number: " << d << endl;
  16. } else {
  17. cout << "NaN: " << d << endl;
  18. }
  19.  
  20. }
Success #stdin #stdout 0.01s 2860KB
stdin
Standard input is empty
stdout
number: 0