fork download
  1. //Vanessa Ramirez CSC5 Chapter 4, p. 224, #20
  2. //
  3. /*******************************************************************************
  4.  * DETERMINE FREEZING AND BOILING
  5.  * _____________________________________________________________________________
  6.  * This program will ask user to enter a temperature. The progam will determine
  7.  * which substances will freeze and which will boil at that temperature.
  8.  * _____________________________________________________________________________
  9.  * INPUT
  10.  * temperature : Temperature entered by user
  11.  *
  12.  * OUTPUT
  13.  * substances : Substances that will freeze or boil
  14.  ******************************************************************************/
  15. #include <iostream>
  16. #include <iomanip>
  17. using namespace std;
  18.  
  19. int main()
  20. {
  21. float temperature; // INPUT - Temperature entered by user
  22.  
  23. // Input
  24. cout << "Enter a temperature: ";
  25. cin >> temperature;
  26.  
  27. // Determine Substances That Will Freeze
  28. cout << "Substances that will freeze:" << endl;
  29.  
  30. if (temperature <= -173)
  31. cout << "Ethyl alchohol" << endl;
  32.  
  33. if (temperature <= -38)
  34. cout << "Mercury" << endl;
  35.  
  36. if (temperature <= -362)
  37. cout << "Oxygen" << endl;
  38.  
  39. if (temperature <= 32)
  40. cout << "Water" << endl;
  41.  
  42. // Determine Substances That Will Boil
  43. cout << "Substances that will boil:" << endl;
  44.  
  45. if (temperature >= 172)
  46. cout << "Ethyl alchohol" << endl;
  47.  
  48. if (temperature >= 676)
  49. cout << "Mercury" << endl;
  50.  
  51. if (temperature >= -306)
  52. cout << "Oxygen" << endl;
  53.  
  54. if (temperature >= 212)
  55. cout << "Water" << endl;
  56.  
  57. return 0;
  58. }
Success #stdin #stdout 0.01s 5288KB
stdin
-20
stdout
Enter a temperature: Substances that will freeze:
Water
Substances that will boil:
Oxygen