urgent help

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2008
Posts: 1
Reputation: dirtdogg is an unknown quantity at this point 
Solved Threads: 0
dirtdogg dirtdogg is offline Offline
Newbie Poster

urgent help

 
0
  #1
Sep 4th, 2008
this is the program:
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. double f0, speed, f1;
  7.  
  8. f0 = 2e-10;
  9. speed = 75;
  10.  
  11. f1 = ((speed + 6.685e8) * f0) / (6.685e8 - speed);
  12.  
  13. cout << "The return frequency corresponding to 75 miles per hour is " << f1 << endl;
  14.  
  15. return 0;
  16. }
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:
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. double f0, speed, f1;
  8.  
  9. f0 = 2e-10;
  10. speed = 75;
  11.  
  12. f1 = ((speed + 6.685e8) * f0) / (6.685e8 - speed);
  13.  
  14. cout << "The return frequency corresponding to 75 miles per hour is " << f1 << endl;
  15. cout.setf(ios::fixed, ios::floatfield);
  16. cout.precision(13);
  17.  
  18. return 0;
  19. }
yet it still does not do it. if anyone would respond i would be grateful
Last edited by Narue; Sep 4th, 2008 at 12:44 pm. Reason: added code tags
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: urgent help

 
0
  #2
Sep 4th, 2008
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 49
Reputation: dexter1984 is an unknown quantity at this point 
Solved Threads: 2
dexter1984 dexter1984 is offline Offline
Light Poster

Re: urgent help

 
1
  #3
Sep 4th, 2008
Maybe you should put
cout.setf(ios::fixed, ios::floatfield);
cout.precision(13);
before you cout your answer?
And please put
  1. code here
when you have codes.
I almost can't see your comments.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC