Advertisements
Advertisements
प्रश्न
Implement of a class temperature to convert degree.Fahernheit value to degree celcuis value.
(Hint: (c/5 = f − 32/9) Where C is temperature in degree celcuis an F is temperature in Fahernheit degree)
कोड लेखन
Advertisements
उत्तर
//C++ program to convert degree.Fahrenheit value to degree celsius value
#include <iostream.h>
class temperature
{
float tcel;
float tfht;
public:
void getdata();
void display();
};
void temperature::getdata(void)
{
cout <<"Enter the degree Fahrenheit";
cin >> tfht;
}
void temperature::display(void)
{
tcel = 5/9 * (tfht - 32);
cout << "The degree celsius:";
cout << tcel;
}
void main()
{
temperature t1;
t1.getdata();
t1.display();
}shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2024-2025 (March) Official
