#include <sstream> #include <string> #include <iostream> using namespace std; int main() { string input; stringstream s; float num; cout << "String: "; cin >> input; s << input; s >> num; cout << num << endl; return 0; } /* OUTPUT: String: 23.4 23.4 */