stringstream()

 
#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main ()
{
  float height=0;
  string mystr;
  cout << "Enter height: ";
  getline (cin,mystr);
  stringstream(mystr) >> height;
  cout << "your height is " << height << endl;
  return 0;
}