Answer: Read F, compute \(C = \dfrac{5(F - 32)}{9}\) inside a class named temperature, and display C.
#include<iostream.h>
#include<conio.h>
class temperature
{
private:
float F, C;
public:
void getdata()
{
cout << "Enter temperature in Fahrenheit: ";
cin >> F;
}
void convert()
{
C = 5.0 * (F - 32) / 9.0;
}
void display()
{
cout << "Temperature in Celsius = " << C;
}
};
void main()
{
temperature t;
clrscr();
t.getdata();
t.convert();
t.display();
getch();
}
Explanation: from the hint \(\frac{C}{5} = \frac{F - 32}{9}\) we get \(C = \frac{5}{9}(F - 32)\). The class keeps F and C as private data, and the public member functions read F, convert it, and print C. Writing 5.0 and 9.0 keeps the division in floating point. Example: F = 212 gives C = 100.