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

Recommended Answers

All 2 Replies

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.

commented: Well said, I just ignored the post because it lacked code tags. +21
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.