For this task , my classmates and I were instructed to create a program that will prompt the user for a temperature in Fahrenheit and them convert it to Celsius. The formula that made the conversion possible was C = 5 ∗ (F − 32)/9 (where F = Fahrenheit).
The resources that helped me were:
-cpluplus.com -How to think like a computer scientist.
I added some extra steps to show more information to the user , depending on the number (x) given , like if:
-Water boils at x temperature.
-Water is in its solid state, ice.
-Water, in its solid state, becomes liquid due to its melting point.
This is my second program , created using cygwin and atom. For this task , my classmates and I were instructed to create a program that will prompt the user for a temperature in Fahrenheit and them convert it to Celsius. The formula that made the conversion possible was C = 5 ∗ (F − 32)/9 (where F = Fahrenheit).
The resources that helped me were:
-cpluplus.com -How to think like a computer scientist.
I added some extra steps to show more information to the user , depending on the number (x) given , like if:
-Water boils at x temperature.
-Water is in its solid state, ice.
-Water, in its solid state, becomes liquid due to its melting point.
-Water does not boil at this temperature.
It really was a fun and entertaining task.
Here you will find my code and some captures:
Atom code.
-Atom code:
#include <iostream>
using namespace std;
int main(){
int f,c;
cout << “This program converts temperature from Fahrenheit to Celsius.” << endl;
cout << “Give me the temperature in Fahrenheit:” << endl;
cin >> f;
cout << “The temperature is ” << f << ” Fahrenheit” << endl;
c = 5*(f-32)/9;
cout <<“The temperature expressed in Celsius is ” << c << ” Celsius” << endl;
if (c >= 100){
cout << “Water boils at this temperature.” << endl;
}
else{
if (c < 0){
cout << “Water is in its solid state, ice.” << endl;
}
else{
cout << “Water, in its solid state, becomes liquid due to its melting point.” << endl;
cout << “Water does not boil at this temperature.” << endl;
}
}
return 0;
}