Hi! I saw a post on this site that exhibited the same exact problem that I have for a homework assignment and while it was solved, my issue with the homework assignment is different. The C++ program that I wrote asked the user to input information but once you enter a number, everything in "" is posted on to the screen at one time. Below I will post the instructions for the homework assignment and, the program that I wrote, and I would really appreciate any help or advice that anyone is able to issue.Thank you.

The following table lists the freezing and boiling points of several substances. Write a program that asks the user to enter a temperature, and then 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.

#include <iostream>
using namespace std;

int main()
{int point; //Freezing and Boiling points

cout<<"Please enter a number for freezing and or boiling points(F):";

cout<<"Freezing Point (F)"<<endl;
if(point>=-173)cout<<"Ethyl alcohol will freeze"<<endl;
if(point>=-38)cout<<"Mercury will freeze"<<endl;
if(point>=-362)cout<<"Oxygen will freeze"<<endl;
if(point>=32)cout<<"Water will freeze"<<endl;

cout<<"\nBoiling Point (F)"<<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;

cout<<"How'd I'd do Rich?"<<endl<<endl<<"Program end";

return 0;

6 Years
Discussion Span
Last Post by tegaelam

I'm not really sure what your actual problem is? Are you saying that all cout in your program is call no matter what the user inputs?
if that's the case try


That was exactly my issue thanks so much geogia!! It is working as it should now.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.