output format
-
printf("%.2f\n", i*j);
- I believe that should do the trick!**
With time we live, with money we spend! Joel Holdsworth.
**
-
printf("%.2f\n", i*j);
- I believe that should do the trick!**
With time we live, with money we spend! Joel Holdsworth.
**
-
char szTemp[256];
sprintf(szTemp, "%.2f\n", i*j);
cout << szTemp;:-D -Dominik
-
You need to use an iomanip function. Unfortunately the VC 6 STL "documentation" is unhelpful, but something like:
cout << setprecision(2) << i*j;
should work. The horrible docs and the complexity of using iomanips is why
printf()
is favored for this type of output. ;) --Mike-- If it doesn't move and it should: WD-40. If it moves and it shouldn't: duct tape. 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click! My really out-of-date homepage Sonork-100.19012 Acid_Helm -
You need to use an iomanip function. Unfortunately the VC 6 STL "documentation" is unhelpful, but something like:
cout << setprecision(2) << i*j;
should work. The horrible docs and the complexity of using iomanips is why
printf()
is favored for this type of output. ;) --Mike-- If it doesn't move and it should: WD-40. If it moves and it shouldn't: duct tape. 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click! My really out-of-date homepage Sonork-100.19012 Acid_HelmMichael Dunn wrote: You need to use an iomanip function. Unfortunately the VC 6 STL "documentation" is unhelpful I didn't know that the iomanip header file was part of the STL.
Nick Parker
You see the Standards change. - Fellow co-worker