How do I get doubles to display with the resolution I want?
setprecision does not work. Here is an example program:
Code:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double d=0.;
for (int i=0; i<10; i++)
{
d += 0.5;
cout << setw(12) << setprecision(6) << d << endl;
}
}
The output looks like this:
Code:
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
I want to display the trailing 000's