when I...

double a = 0.00000001;
cout<< a <<endl;

The computer outputs 1e-07. I want to force the computer to write it as 0.00000001

thanks! ;)

I also need to be able to right justify items I am printing, or add 0's to the beginning of integers so that they ALL are exactly 8 digits long. (my ints do not exceed 99999999)

setprecision must take away digits, but it will not add 0's when the integer is not long enough!

Thank you for your help so far. That was very useful and allowed me to fix part of my code :)

If you scroll to the bottom of that website you linked you will see unsetf().

Here is an example

#include <iostream>
using namespace std;

int main()
{
	cout.setf(ios_base::fixed);
	cout << 100.1 << endl; //with fixed
	cout.unsetf(ios_base::fixed);
	cout << 100.2 << endl; //without fixed

	return 0;
}

Edited 5 Years Ago by sfuo: n/a

This question has already been answered. Start a new discussion instead.