Program:
#include<iostream.h>
#include<conio.h>
class inches
{
private:
float in,tot;
public:
void getinch(void);
void showinch(void);
};
class feet
{
private:
float ft,tot;
public:
void getfeet(void);
void showfeet(void);
};
void inches::getinch(void)
{
cout<<"\n\nEnter inches : ";
cin>>in;
}
void inches::showinch(void)
{
float inch=1;
float feet=0.083333333;
if(inch<=in)
{
tot=in*feet;
cout<<"\n\nThe Entering Inches is converted into the Feet : "<<tot<<endl;
}
else
{
cout<<"0";
}
}
void feet::getfeet(void)
{
cout<<"\n\nEnter feet : ";
cin>>ft;
}
void feet::showfeet()
{
float feet=1;
float inch=12;
if(feet<=ft)
{
tot=ft*inch;
cout<<"\n\nThe Entering Feet is converted into Inches : "<<tot<<endl;
}
else
{
cout<<"0";
}
}
void main()
{
char a,b,c;
l:
clrscr();
inches i;
feet f;
cout<<"\n\nDo you want to convert Inches into Feet : ";
cin>>a;
if(a=='y'||a=='Y')
{
i.getinch();
i.showinch();
}
cout<<"\n\nDo you want to convert Feet into Inches :
cin>>b;
if(b=='y'||b=='Y')
{
f.getfeet();
f.showfeet();
}
cout<<"\n\n\t\tConversion over"<<endl;
cout<<"\t\t********** ****"<<endl;
cout<<"\n\nDo u want to continue[y/n] : ";
cin>>c;
if(c=='y'!!c=='Y')
goto l;
getch();
}