Need help with a class please
Learning classes, and trying to make it all work. This code compiles OK, but when I execute, and say use the number 100 as the Farenheit temperature input, I always get -17.7778 as the Celcius equivalent, even when I change the Farenheit temp input. What is my problem here?
code:_____________________________________________ __
#include <iostream.h>
class Thermometer
{
public:
Thermometer(); //constructor
void setThermometer(double); //function to set temp
void getFarenheit(double); //function to get temp in F
void getCelcius(double); //function to get temp in C
private:
double FarenTemp; //data members in F
};
//Temperature constructor to initialize the data members to zero
Thermometer::Thermometer() {FarenTemp = 0;}
//Function to set temperature using Farenheit.
void Thermometer::setThermometer(double temp)
{
temp = FarenTemp;
}
//Function to get temperature in degrees F from the user
void Thermometer::getFarenheit(double t)
{
cout<<"Enter a temperature in degrees Farenheit: ";
cin>>t;
}
//Funtion to get temperature in degrees C from the user
void Thermometer::getCelcius(double)
{
cout<<"The temperature in Celcius: "<<(((FarenTemp - 32 ) * 5 ) / 9 );
}
int main()
{
Thermometer x; //instantiates object x of class Thermometer
x.getFarenheit(1);
x.getCelcius(1);
cout<<endl;
return 0;
}
end code:___________________________________________