if you're querying the user for input, and want that input to be stored as a double by the program, you could just use
1 2
double x;
cin >> x;
Even if the user enters the value '23', it will still get stored as a double '23.0'.
If, however, you want to enforce input in a particular format, such as ##.# (requiring at least one value after the decimal place), you can receive the input into a string, parse that string to verify it's the appropriate format, then dump it into a double.