0

this is the program:

#include <iostream>
using namespace std;

int main()
{
	double f0, speed, f1;
	
	f0 = 2e-10;
	speed = 75;

	f1 = ((speed + 6.685e8) * f0) / (6.685e8 - speed);
	
	cout << "The return frequency corresponding to 75 miles per hour is " << f1 << endl;
	
	return 0;
}

i amsupposed to get a output of 2.000000449 x 10^-10 but i get a output of 2 X 10^-10. i need more decimal places to be shown on the screen.
i did some research and tried this method:

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
	double f0, speed, f1;
	
	f0 = 2e-10;
	speed = 75;

	f1 = ((speed + 6.685e8) * f0) / (6.685e8 - speed);
	
	cout << "The return frequency corresponding to 75 miles per hour is " << f1 << endl;
	cout.setf(ios::fixed, ios::floatfield);
	cout.precision(13);

	return 0;
}

yet it still does not do it. if anyone would respond i would be grateful

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by dexter1984
1

Maybe you should put
cout.setf(ios::fixed, ios::floatfield);
cout.precision(13);
before you cout your answer?
And please put

code here

when you have codes.
I almost can't see your comments.

Votes + Comments
Well said, I just ignored the post because it lacked code tags.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.