0 votes
12 views
Implement a class temperature to convert degree Fahrenheit value to degree Celsius value [Hint:  C/5 = F – 32 / 9 where C is temperature in degree Celsius and F is temperature in Fahrenheit) [March 2006, March 2009]
from Computer science maharashtra board
in Programming by (5.4k points) | 12 views

1 Answer

0 votes
Best answer
#include<iostream.h>
class convert
{private:
float C,F;
public:
void getdata();
void cal();
void display();
};

void convert::getdata()
{
cout<<"Enter temperature in centigrade ";
cin>>C;
}
void convert::cal()
{
F=1.8*C +32;
}
void convert::display()
{
cout<<"The temperature in Fahrenheit is : "<<F;
}

void main()
{
convert temperature;
temperature.getdata();
temperature.cal();
temperature.display();
}
 

Only for Turbo C++
by (5.4k points)
500 questions
477 answers
8 comments
12 users