0

I have been trying to figure out for the life of me what I am doing wrong here, and I am coming up blank. My operator is returning the correct value in temp - as you can see highlighted in red, however, when I use the operator in main - it is not giving me the correct value. What is it that I am missing :-(

Implementation File

```
Term Term::operator +=(const Term &t)
{
Term temp;
if (exponent == t.exponent)
{
temp.coefficient = coefficient + t.coefficient;
temp.exponent = exponent;
}
cout<<"temp= "<<temp<<endl; //this is returning the correct value
return (temp);
}
```

Here is the application file

```
void operatorTest(Term &x)
{
Term y;
cout<<"Enter another term: "<<endl;
cin>>y;
if (x != y)
cout<<"The exponents are not equal. They cannot be added"<<endl;
else
x+=y;
cout<<"The new term is: "<<x<<endl; //this is only giving me the value of x and not x+=y
}
```

*Edited 6 Years Ago by wittykitty*: n/a