Code:
#include <iostream>
using namespace std;
class dist
{
private:
int feet;
int inches;
public:
int publicfeet;
float publicinches;
void getdist()
{
cout<<"\nEnter Feet : ";
cin>>feet;
cout<<"\nEnter Inches : ";
cin>>inches;
if(inches>=12)//It will correct the inches...
{
feet=feet+inches/12;
inches=inches%12;
cout<<"\nNote: The Distance Value is corrected to "<<feet<<"\""<<inches<<"\'\n";
}
}
void largedist(dist a, dist b)
{
if(a.feet>b.feet)
{feet=a.feet;
inches=a.inches;
}
else if (a.feet<b.feet)
{ feet=b.feet;
inches=b.inches;
}
else if(a.feet==b.feet)
{
if(a.inches>b.inches)
{feet=a.feet;
inches=a.inches;}
else if(a.inches<b.inches)
{
feet=b.feet;
inches=b.inches;
}
}
cout<<"\nLarger distace = "<<feet<<"\""<<inches<<"\'";
}
};
void main()
{
dist a,b,larger;
a.getdist();
b.getdist();
larger.largedist(a,b);
}