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! ;)

You can use setpercision() to do this. Here has some good examples.

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 :)

help please

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;
}

thank you so much man. i will be using this tomorrow ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.