fork download
  1. // Nicolas Ruano CS1A Chapter 3, Pp.
  2. /*******************************************************************************
  3.  CONVERTING CELCIUS INTO FAHRENHEIT
  4. *______________________________________________________________________________
  5. *This program demonstrates a procedurre of how we convert Celcius into
  6. *Faherenheit
  7.  
  8. *******************************************************************************/
  9. // Celsius to Fahrenheit Converter
  10. // This program converts Celsius temperatures to Fahrenheit.
  11.  
  12. #include <iostream>
  13. #include <iomanip>
  14. using namespace std;
  15.  
  16. int main() {
  17. double celsius, fahrenheit;
  18.  
  19. // Ask user for Celsius input
  20. cout << "Enter the temperature in Celsius: ";
  21. cin >> celsius;
  22.  
  23. // Convert to Fahrenheit
  24. fahrenheit = (9.0 / 5.0) * celsius + 32;
  25.  
  26. // Display result
  27. cout << fixed << setprecision(2);
  28. cout << celsius << " degrees Celsius is equal to "
  29. << fahrenheit << " degrees Fahrenheit." << endl;
  30.  
  31. return 0;
  32. }
  33.  
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
Enter the temperature in Celsius: 0.00 degrees Celsius is equal to 32.00 degrees Fahrenheit.