0 votes
137 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 Expert (10.7k points) | 137 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 Expert (10.7k points)

Related questions

714 questions
695 answers
11 comments
24 users