Re: Fahreinheit to Kelvin

From Shannon, 2 Years ago, written in C++, viewed 82 times. This paste is a reply to Fahreinheit to Kelvin from Shannon - view diff
URL https://paste.codexterous.com/view/18914b12 Embed
Download Paste or View Raw
  1. Write a program that converts Fahreinheit to Kelvin.  Round to one decimal place.  The formula is as follows:
  2. (F - 32) * (5 / 9) + 273.15
  3.  
  4. OK, so im almost there with this.
  5.  
  6.  
  7. #include <iostream>
  8. #include <iomanip>
  9.  
  10. using namespace std;
  11.  
  12. int main ()
  13. {
  14.  
  15. double tempK, tempF = 0;
  16.  
  17. cout<< "== Fahrenheit to Kelvin converter =="<< endl;
  18.  
  19. cout <<"Enter Fahrenheit:"<< endl; //prompt user
  20.  
  21. tempK = ((tempF - 32) * 5) / 9 + 273.15;
  22.  
  23. cout<< fixed;
  24.  
  25. cin>> tempF;
  26.  
  27. cout<< "Kelvin: " << setprecision(2) << tempK << showpoint;
  28.  
  29. return 0;
  30.  
  31. }

Reply to "Re: Fahreinheit to Kelvin"

Here you can reply to the paste above