c++ program to create a class distance ,which accepts data in feet and inches, add two distances and displays the members of the distance object and add data of object display them.

#include<iostream.h>
#include<conio.h>
class distance
{
private:
int feet,inch;
public:
void getdistance();
void putdistance();
void adddistance(distance d1,distance d2);
};
void distance::getdistance()
{
cout<<“\nEnter the feet : “; cin>>feet;
cout<<“\nEnter the inches :”; cin>>inch;
}
void distance::putdistance()
{
cout<<“\n\nfeet = “<<feet;
cout<<“\tinch = “<< inch;
}
void distance::adddistance(distance d1,distance d2)
{
inch=d1.inch+d2.inch;
feet=inch/12;
inch=inch%12;
feet=feet+d1.feet+d2.feet;
}
int main()
{
distance d1,d2,d3;
clrscr();
cout<< “\nDistance 1 \n”;
d1.getdistance();
cout<< “\nDistance 2 \n”;
d2.getdistance();
d3.adddistance(d1,d2);
cout<<“\nThe Sum Of two distance is : “;
d3.putdistance();
getch();
return(0);
}…………………………….output………………………………distance 1

enter the feet:
6

enter the inches:
7

distance 2

enter the feet:
5

enter the inches:
7

the sum of two distance is:
feet:12 inches:2