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