fork download
  1. #include <string>
  2. #include <iostream>
  3.  
  4. int main() {
  5. std::string S1("3.1415");
  6. std::cout << "int : " << std::stoi(S1) <<std::endl;
  7. std::cout << "float : " << std::stof(S1) <<std::endl;
  8. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
int   : 3
float : 3.1415