Whats in this post?
- Background and Explanation of the code
To copy code: Click “View Source” on the right of this code snippet.
Background and Explanation of the code
The above program adds two distances entered by the user.For this we have created a class distance having member functions read ( ), show ( ) and add ( ) to input , display and add the distances respectively.The distance is specified in terms of feet and inches.
Enter feet and inches : 4 9
Enter feet and inches : 6 5
Addition is : 11 ‘ -2″