|
-
April 24th, 1999, 07:29 AM
#1
How convert a exponent double data to a string?
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
-
April 24th, 1999, 08:54 AM
#2
Re: How convert a exponent double data to a string?
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
-
April 24th, 1999, 08:55 AM
#3
Re: How convert a exponent double data to a string?
Also, to copy then to CString format use strcpy so
strcpy(j, str);
-
April 24th, 1999, 08:03 PM
#4
Re: How convert a exponent double data to a string?
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
-
April 24th, 1999, 08:12 PM
#5
I get it.Thanks!
using sprintf(...,%e,...),I get it.
Thanks!
vector
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|