*file<<uppercase<<scientific<<value
if value=0.01;
On Visual Studio C++, this line will generate this output :
1E-002
I would like to have 2 digits for the exponent only .
How can I do that ? May I use fprintf instead ??!
Thanks for your help
And sorry for my english !
Convert it to float. Number of digits in the exponent
depends on the range, I guess.
Victor
--
Please remove capital A's from my address when replying by mail
The C standard that Visual C++ claims to conform to, and mostly does,
specifies that scientific notation output must contain at least two
digits in the exponent. It does not place a maximum value, and many
compilers use at least three.
The 1999 update to the C standard requires that a compiler provide at
least two digits, and no unnecessary leading zeros beyond two digits,
but Visual C++ does not even attempt to conform to this standard
version.
I believe Visual C++ will generate three digits for any of the
*printf() family functions as well. If you must have only two digits,
use a C or C++ function to format the output into a std::string or
character array, for example sprintf(), and modify the resulting
string to remove the extra '0' before outputting to the file.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq