Develop a class "measure" with members feet(int) and inches (float) with member functions get(), diplay() and sum() to read, print and add two distances respectively. Note: The member function sum take object of measure class as an argument. Input: First line of input: a single space separated feet and inch. Second line of input: a single space separated feet and inch. Output: Must print the sum of two distances with single space separated feet and inch. Test Case 1 Input (stdin) 22 3.6 4 10 Expected Output 27 feet 1.6 inches Test Case 2 Input (stdin) 5 3.8 12 6 Expected Output 17 feet 9.8 inches
#include <iostream>
using namespace std;
int main()
{
float a,c,feet,b,d,inch,m,n;
cin>>a>>c>>b>>d;
feet=a+b;
inch=c+d;
if((c+d)>12)
m=(int(c+d))%12;
else
m=0;
cout<<feet+m<<" feet "<<inch-m*12<<" inches";
return 0;
}