fork(1) download
  1. #include <cstdio>
  2. #include <iomanip>
  3. #include <iostream>
  4. #include <sstream>
  5. using namespace std;
  6.  
  7. int main() {
  8. double foo;
  9.  
  10. sscanf("0xd", "%lg", &foo);
  11. cout << foo << endl;
  12.  
  13. istringstream("0xd") >> foo;
  14. cout << foo << endl;
  15.  
  16. istringstream("0xd") >> hex >> foo;
  17. cout << foo << endl;
  18.  
  19. istringstream("d") >> hex >> foo;
  20. cout << foo << endl;
  21. }
Success #stdin #stdout 0s 3412KB
stdin
0x1a
1a
stdout
13
0
0
0