0 votes
1.2k views
in Programming by (98.9k points)
reopened by
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]

1 Answer

0 votes
by (98.9k points)
edited by
 
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++

Related questions

Doubtly is an online community for engineering students, offering:

  • Free viva questions PDFs
  • Previous year question papers (PYQs)
  • Academic doubt solutions
  • Expert-guided solutions

Get the pro version for free by logging in!

5.7k questions

5.1k answers

108 comments

537 users

...