D
deanfamily11
I'm trying to have this program do a simple temperature conversion from
Fahrenheit to Celsius. I have confirmed that the other variable is
receiving and calculating the conversion, but it is just outputting as "0".
Any thoughts? (Code is below)
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
//declare variable
int fahre;
double centi;
//get the temperature
cout << "Welcome to the temperature converter." << endl << endl;
cout << "Enter a temperature in degrees Fahrenheit: ";
cin >> fahre;
cout << endl;
cout << endl;
cout << endl;
//convert the temperature to centigrade
centi = (fahre - 32) * (5 / 9);
//output both the original temperature and the converted one
cout << "Below is your original and converted temperatures." << endl;
cout << "Degrees F: " << fahre << endl;
cout << "Degrees C: " << centi << endl;
return 0;
}
Fahrenheit to Celsius. I have confirmed that the other variable is
receiving and calculating the conversion, but it is just outputting as "0".
Any thoughts? (Code is below)
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
//declare variable
int fahre;
double centi;
//get the temperature
cout << "Welcome to the temperature converter." << endl << endl;
cout << "Enter a temperature in degrees Fahrenheit: ";
cin >> fahre;
cout << endl;
cout << endl;
cout << endl;
//convert the temperature to centigrade
centi = (fahre - 32) * (5 / 9);
//output both the original temperature and the converted one
cout << "Below is your original and converted temperatures." << endl;
cout << "Degrees F: " << fahre << endl;
cout << "Degrees C: " << centi << endl;
return 0;
}