I want a code that can convert floating/double value into string/char array(char arr[]) and also it can be run on Boreland C++ 5.02
Here I've a code but it doesn't show all the numbers. Instead, it's showing in exponential form which I don't want!!
int main()
{
char* str = new char[30];
float flt = 2.4567F;
sprintf(str, "%.4g", flt );
cout<<str<<endl; //Exponential form even after 6 digits without decimal
return 0;
}
sprintf(str, "%.4f", flt );
f, not g.
Thanks!! Problem solved.. :D (Y)
Can u plz.. tell me that how this function works.....
sprintf(str, "%.4f", flt );
or sprintf( );