#include<iostream.h>
//using namespace std;
class Temp
{
float c,f;
public:
void get_temp(void);
void convert(void);
void display(void);
};
void Temp::get_temp(void)
{
cout<<"\nEnter the temparature : ";
cin>>c;
};
void Temp::convert(void)
{
f=(c-32)/9.8;
};
void Temp::display(void)
{
cout<<"Temparature in F = "<<f;
};
void main()
{
Temp t;
t.get_temp();
t.convert();
t.display();
}
//using namespace std;
class Temp
{
float c,f;
public:
void get_temp(void);
void convert(void);
void display(void);
};
void Temp::get_temp(void)
{
cout<<"\nEnter the temparature : ";
cin>>c;
};
void Temp::convert(void)
{
f=(c-32)/9.8;
};
void Temp::display(void)
{
cout<<"Temparature in F = "<<f;
};
void main()
{
Temp t;
t.get_temp();
t.convert();
t.display();
}
RELATED TOPICS |
---|
Write a C++ Program to demonstrate class. |
Write a C++ Program to demonstrate scope resolution operator. |
No comments:
Post a Comment