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.

what is error!!

–1 vote
asked Sep 14, 2019 by Ko Ki (130 points)
#include <iostream>
#include<string>
#include<iomanip>
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;
}

2 Answers

0 votes
answered Sep 16, 2019 by John Barden (140 points)
You only need to change the name of the struct. "distance" is also a function in the c++ STL. It just makes the compiler unsure if you're declaring something or calling the function.
commented Sep 16, 2019 by Ko Ki (130 points)
edited Sep 16, 2019 by Ko Ki
thank you for your help
0 votes
answered Sep 16, 2019 by H
line 2 in main has cin >>x.feed

should be cin >> x.feet
commented Sep 16, 2019 by Ko Ki (130 points)
thank you for your help
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...