Sunday, December 2, 2012

Conversion of Temperature from Fahrenheit to Celsius using classes in C++


#include<iostream.h>
#include<conio.h>
class temp
{
public:
float gett()
{
float f;
cout<<"Enter the temparature in farhenheit";
cin>>f;
return f;
}
float calc(float)
{
float c,f;
c=(f-32)*5/9.0;
return c;
}
void display(float)
{
int c;
cout<<"\n Temparature in centigrade is:"<<c;
}
};
int main()
{
float c,f;
temp t;
t.gett();
t.calc(f);
t.display(c);
return 0;
}

No comments:

Post a Comment

DC motor control with Pulse Width Modulation Part 1

DC Motor intro DC motor is a device which converts electrical energy into kinetic energy. It converts the DC power into movement. The typica...