fork download
  1. //Andres Guzman CSC5 Chapter 3, P. 144, #10
  2. //
  3. /**************************************************************
  4. *
  5. * CONVERT CELSIUS TO FAHRENHEIT TEMPERATURE
  6. * ____________________________________________________________
  7. * This program will convert one temperature type to another
  8. * Computation is based on the formula:
  9. * f = 9/5 C + 32
  10. * ____________________________________________________________
  11. * INPUT
  12. * c : Temperature in celsius
  13. * OUTPUT
  14. * f : temperature in fahrenheit
  15. **************************************************************/
  16. #include <iostream>
  17. using namespace std;
  18.  
  19. int main ()
  20. {
  21. float c;
  22. //
  23. //Output result
  24. cout << "C: ";
  25. cin >> c;
  26. float f = c;
  27. f = f * 9/5 + 32;
  28. cout << "\nF: " << f << endl;
  29. return 0;
  30. }
Success #stdin #stdout 0s 5328KB
stdin
23
stdout
C: 
F: 73.4