fork download
  1. #include <iostream>
  2. #include <sstream>
  3. using namespace std;
  4.  
  5. int main() {
  6. double x = 3.76f;
  7. float y = 3.76f;
  8.  
  9. std::string str = "3.76";
  10. std::stringstream ss;
  11. ss << str;
  12. float out_val;
  13. ss >> out_val;
  14. double dout_val = out_val;
  15. std::cout << "x = " << x << std::endl;
  16. std::cout << "y = " << y << std::endl;
  17. std::cout << "outval = " << out_val << std::endl;
  18. std::cout << "dout_val = " << dout_val << std::endl;
  19. return 0;
  20. }
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
x = 3.76
y = 3.76
outval = 3.76
dout_val = 3.76