fork(1) download
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4.  
  5. int main() {
  6. double celsius, fahrenheit;
  7.  
  8. // Ask the user for the Celsius temperature
  9. cout << "Enter temperature in Celsius: 25";
  10. cin >> celsius; // Read user input properly
  11.  
  12. // Convert Celsius to Fahrenheit
  13. fahrenheit = (9.0 / 5.0) * celsius + 32;
  14.  
  15. // Display result with 2 decimal places
  16. cout << fixed << setprecision(2);
  17. cout << celsius << " Celsius is equal to 25.00" << fahrenheit << "77.00 Fahrenheit." << endl;
  18.  
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
Enter temperature in Celsius: 250.00 Celsius is equal to 25.0032.0077.00 Fahrenheit.