compiler is showing this error but I don't know where I went wrong with my simple structure program.

#include <iostream>
#include <conio.h>
using namespace std;
#include<iostream>
#include<conio.h>
using namespace std;
struct distance                //structure 
{
    int foot;
    float inches;
}; 
int main()
{

distance a,b;
distance c={3,6.34};
cout<<"Enter feet and inches of distance a"<<endl;
cin>>a.foot<<a.inches<<endl;
b.inches=c.inches+a.inches;
b.foot=c.foot+a.foott;
cout<<"distance a: "<<a.foott<<a.inches<<endl;
cout<<"distance b: "<<b.foott<<b.inches<<endl;
cout<<"distance c: "<<c.foott<<c.inches<<endl;
getche();
return 0;
}

Plese post the entire compiler error output. However, line 18 is wrong. Instead of cin>>a.foot<<a.inches<<endl; try cin>>a.foot>>a.inches;

distance is the name of a function in the standard library, use it for something else at your own risk.

Check your spelling and choice of operators as well.

it stiil says [Error] reference to 'distance' is ambiguous even after I've corrected the 18th line..

Like was mentioned you've used a keyword as a custom type. Line 18 has nothing to do with that error. Change the name of your struct.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.