Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

where is the error????

0 votes
asked Sep 12, 2019 by Ko Ki (130 points)
#include <iostream>
using namespace std;
struct distance{
float feet ;
float inches;

};
distance add_distance(distance d1,distance d2){

distance result;
result.feet=d1.feet+d2.feet;
result.inches=d1.inches+d2.inches;
return result;
}
int main()
{
    distance x,y,z;
    cin>>x.feed>>y.feet;
    cin>>x.inches>>y.inches;
    z=add_distance(x,y);
    cout<<z.feet<<"  "<<z.inches<<endl;
    return 0;
}

1 Answer

0 votes
answered Sep 13, 2019 by Angel
2 problems:

1. distance struct is ambiguous because it already exists. Rename to dist or something else.

2. Your first cin inside main has a typo. x.feed instead of x.feet
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and receive answers from other members of the community.
...