fork download
  1. //Matthew Santos CS1A Ch. 3, Pg. 144, #10
  2. /***********************************************
  3.  *
  4.  * CONVERT CELSIUS TO FARENHEIT
  5.  * _____________________________________________
  6.  * Takes degrees in celsius and converts and
  7.  * outputs in farenheit.
  8.  * _____________________________________________
  9.  * INPUT
  10.  * degreec : degrees in celsius
  11.  *
  12.  * OUTPUT
  13.  * degreef : degrees in farenheit
  14.  ***********************************************/
  15. #include <iostream>
  16. #include <iomanip>
  17. using namespace std;
  18.  
  19. int main() {
  20.  
  21. //Define inputs and outputs
  22. float degreec;
  23. float degreef;
  24.  
  25. //Acquire degrees in celsius
  26. cin >> degreec;
  27.  
  28. //Converts to farenheit
  29. degreef = (9 / 5) * degreec + 32;
  30.  
  31. //Outputs degrees
  32. cout << "Degrees (farenheit): " << degreef;
  33.  
  34. return 0;
  35. }
Success #stdin #stdout 0.01s 5284KB
stdin
89
stdout
Degrees (farenheit): 121