class distance
{ private : int feet;
float inches;
public : distance () { feet = 0; inches = 0.0;}
distance (int ft, float in) { feet =ft; inches = in; }
void get_dist()
{ cout << "\n Enter feet:"; cin >> feet;
cout << "\n Enter Inches:"; cin >> inches; }
void show_dist()
{ cout << feet << "\'-" < =12.0) { inches - = 12.0; feet++; }
}
void main()
{ distance dist1; distance dist2(11,6.25);
dist1 .get_dist();     cout << "\ndistl ="; dist1 .show_dist(); 
cout << "\ndist2 = "; dist2.showdist();
dist1 += dist2;    cout << "\n After addition"; 
cout << "\ndistl = "; dist1 .showdist();
}
Click here to go back.

Our aim is to provide information to the knowledge seekers. 


comments powered by Disqus


Footer1