Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The following table lists the freezing and boiling points of several substances.

ID: 3528507 • Letter: T

Question

The following table lists the freezing and boiling points of several substances. Write a program that asks the user to enter a temperature, and the shows all the substances that will freeze at that temperature and all that will boil at that temperature. For example, if the user enters -20 the program should report that water will freeze and oxygen will boil at that temperature. . ________________________________________________ --- Substace ----- Freezing Point (?F) ----- Boiling point (?F) ________________________________________________ --- Ethyl alcohol ------ -173 -------------------- 172 --- Mercury ------------- -38 --------------------- 676 --- Oxygen ------------ -362 ------------------- -306 --- Water ---------------- 32 ----------------------- 212 #include using namespace std; int main() { int temp; //declare variable int Freezing_E=-173,Freezing_M=-38, Freezing_O=-362, Freezing_W=32; int Boiling_E=172, Boiling_M=676,Boiling_O=-306,Boiling_W=212; cout << "Enter Temperature: "; cin >> temp; int point; //user point to hold Freezing or Boiling points //input cout << "Please enter a number for Freezing or Boiling points(F): "; cin >> point; cout << "Test Freezing point..." << endl; if(point>=-173) cout << "Ethyl alcohol will freeze" << endl; if(point>=-36) cout << "Mercury will freeze" << endl; if(point>=-362)cout << "Oxygen will freeze" << endl; if(point>=32) cout << "Water will freeze" << endl; cout << " Test Boiling point..."<<endl; if(point<=172) cout << "Ethyl alcohol will boil" << endl; if(point<=676) cout << "Mercury will boil" << endl; if(point<=-306)cout << "Oxygen will boil" << endl; if(point<=212) cout << "Water will boil" << endl; return 0; } what did I do wrong??????????? wont compile its C++

Explanation / Answer

#include<iostream>

using namespace std;


int main() {

int temp;

//declare variable

int Freezing_E=-173,Freezing_M=-38, Freezing_O=-362, Freezing_W=32;

int Boiling_E=172, Boiling_M=676,Boiling_O=-306,Boiling_W=212;

//cout << "Enter Temperature: ";

//cin >> temp;

int point;

//user point to hold Freezing or Boiling points

//input

cout << "Please enter a number for Freezing or Boiling points(F): ";

cin >> point;

cout << "Test Freezing point..." << endl;

if(point<=-Freezing_E)

cout << "Ethyl alcohol will freeze" << endl;

if(point<=Freezing_M)

cout << "Mercury will freeze" << endl;

if(point<=Freezing_O)

cout << "Oxygen will freeze" << endl;

if(point<=Freezing_W)

cout << "Water will freeze" << endl;


cout << " Test Boiling point..."<<endl;

if(point>=Boiling_E)

cout << "Ethyl alcohol will boil" << endl;

if(point>=Boiling_M)

cout << "Mercury will boil" << endl;

if(point>=-Boiling_O)

cout << "Oxygen will boil" << endl;

if(point>=Boiling_W)

cout << "Water will boil" << endl;


cout<<"Press any key to continue . . ."<<endl;

cin.get();

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote