Hello
.
.
double i=1.2e21;
CString j;
.
.
I want j equal "1.2e21",how can I get that?
Thanks in advance.
Programe is very interesting!
Markup
Printable View
Hello
.
.
double i=1.2e21;
CString j;
.
.
I want j equal "1.2e21",how can I get that?
Thanks in advance.
Programe is very interesting!
Markup
To convert a double to a string, you do
char str[80];
double a = 32433.2321;
sprintf(str, "%f", a);
The second argument, which in this case is "%f", can be formatted just
like the printf format.
Hope this helps.
Danielle
Also, to copy then to CString format use strcpy so
strcpy(j, str);
Thanks a lot.
But the length of the string is very short,so when I finish the convertion I want to keep the exponent format in the string.
like
.
double i=2.3e300;
CString j;//its length is 10 chars.
.
In my program j must have the form
" 2.3e300",how can do that?
thanks.
vector
using sprintf(...,%e,...),I get it.
Thanks!
vector