// Cenyao Huang CS1A Homework 5, p. 224, #20
/******************************************************************************************************
* DISPLAY FREEZING AND BOILING SUBSTANCES
*
* This program displays what substances will freeze and boil at the specific
* temperature inputted.
*
* Input
* temp : the value of the temperature entered
*
* Output
* It will display the substances that will boil and freeze at that temperature
*
****************************************************************************************************/
#include <iostream>
#include <string>
using namespace std;
int main() {
// assign variables
float temp;
int count = 0;
// ask for and display temperature
cout << "Please enter a temperature in fahrenheit: ";
cin >> temp;
cout << temp << "°F" << endl;
// display substances that will boil
if (temp >=172) {
cout << "Ethyl alcohol will boil." << endl;
count += 1;
}
if (temp >=676) {
cout << "Mercury will boil." << endl;
count += 1;
}
if (temp >= -306) {
cout << "Oxygen will boil." << endl;
count += 1;
}
if (temp >= 212) {
cout << "Water will boil." << endl;
count += 1;
}
// display substances that will freeze
if (temp <= -173) {
cout << "Ethyl alcohol will freeze." << endl;
count+=1;
}
if (temp <= -38) {
cout << "Mercury will freeze." << endl;
count+=1;
}
if (temp <= -362) {
cout << "Oxygen will freeze."<< endl;
count+=1;
}
if (temp <= 32) {
cout << "Water will freeze." << endl;
count+=1;
}
// display message if none of the substances boil or freeze
if (count == 0)
cout << "None of the substances will boil or freeze at this temperature.";
return 0;
}