Home

Advertisements

Recent Posts

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 … Continue reading 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.

More Posts