Anyone know how to convert a string
to long double
? For example lets say we have
string S = "3.236568949"
I want to take what inside the string and convert it to a long double variable x
.
Note: In c++11 their exist stold
function do so but I'm using c++98 not c++11.
Also I don't need to cout the string with certain precision because I know setprecision
function already but what I want is just to convert to long double
. In other wards,I need x to equal the exact number inside the string and not an approximated version of the number. Finally I want to tell you that my string contains a valid number.