#WSQ02

The objective of this program is to convert temperature in Fahrenheit to Celsius, and will also tell  you the state of the water at that temperature. Here’s the code:

#include <iostream>

using namespace std;

int main ()
{
int f, c, w;

cout<<“Introduce the temperature in Fahrenheit and I will convert it to Celsius.”<<endl;
cout<<“I will also tell you the state of water at that temperature.”<<endl;
cin>>f;
c=5*(f-32)/9;
cout<<“The temperature in Celius is “<<c<<“.”<<endl;
if (c>=100)
{
cout<<“Water is at its boiling temperature.”<<endl;
}
else if (c==4)
{
cout<<“Water is at its maximum density.”<<endl;
}
else if (c<100 && c>0)
{
cout<<“Water is not yet at its boiling temperature.”<<endl;
}
else if (c<=0)
cout<<“Water is at its freezing temperature.”<<endl;
return 0;
}

WSQ02.png

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s