Converting a floating point number to a string.

Basically we can not convert a floating point number into a string as it is in

1
2
3
4
#include<string>
string str; 
float x=0.01;
str = x;


I want to know whether if there is any function or any way to convert that kind of a floating or any kind of a number into a string.

I know that there is function in cstdlib as "atof()"(a to f) which converts a string into a floating point number. But I want to know the reverse way.
Topic archived. No new replies allowed.