D
David Casey
I'm trying to output 2 decimal places to the screen even when the last
digit would be 0. Here is what I have now:
#include <iostream.h>
#include <iomanip.h>
double custname=0;
void main()
{
custname=12.5;
cout << setprecision(4) << custname;
}
When I set custname to a value like 12.59 it prints 12.59. But the above
only prints 12.5. I've searched and tried several different ways on Google
and nothing seems to work.
Just so you know, I'm just starting out with C++. Thanks in advance for
any help anyone can provide.
Dave
--
You can talk about us, but you can't talk without us!
US Army Signal Corps!!
http://www.geocities.com/davidcasey98
Remove "IH8SPAM" to reply!
digit would be 0. Here is what I have now:
#include <iostream.h>
#include <iomanip.h>
double custname=0;
void main()
{
custname=12.5;
cout << setprecision(4) << custname;
}
When I set custname to a value like 12.59 it prints 12.59. But the above
only prints 12.5. I've searched and tried several different ways on Google
and nothing seems to work.
Just so you know, I'm just starting out with C++. Thanks in advance for
any help anyone can provide.
Dave
--
You can talk about us, but you can't talk without us!
US Army Signal Corps!!
http://www.geocities.com/davidcasey98
Remove "IH8SPAM" to reply!