fork download
  1. // Nicolas Ruano CS1A Chapter 3 Pp. 144 #10
  2. /*******************************************************************************
  3.  * CONVERTING CELSIUS INTO FAHRENHEIT
  4.  * ____________________________________________________________________________
  5.  * Based on the problem below, we have to figure out how to solve a Chemistry-
  6.  * Mathematical problem of how we convert Celcius into Fahrenheit
  7.  * ____________________________________________________________________________
  8.  * INPUT
  9.  * Given value = 100 degrees Celcius
  10.  *
  11.  * We solve with the following formula provided for solving:
  12.  * fahrenheit = (9.0/5.0) * celsius +32
  13.  * ___________________________________________________________________________
  14.  *
  15. *******************************************************************************/
  16. #include <iostream>
  17. #include <iomanip>
  18. using namespace std;
  19.  
  20. int main() {
  21. double celsius, fahrenheit;
  22.  
  23. // Ask user for Celsius temperature
  24. cout << "Enter temperature in Celsius: 100";
  25. cin >> celsius;
  26.  
  27. // Convert to Fahrenheit
  28. fahrenheit = (9.0 / 5.0) * celsius + 32;
  29.  
  30. // Display result
  31. cout << fixed << setprecision(1);
  32. cout << celsius << " degrees Celsius = 100.00" << fahrenheit << "212.00 degrees Fahrenheit." << endl;
  33.  
  34. return 0;
  35. }
  36.  
Success #stdin #stdout 0.01s 5324KB
stdin
Standard input is empty
stdout
Enter temperature in Celsius: 1000.0 degrees Celsius = 100.0032.0212.00 degrees Fahrenheit.