Says I forgot the '&' but I didn't???
Mar 10, 2013 at 6:50pm UTC
It says "invalid use of member (did you forget the '&') ?"
I have never had a problem using the
&&
before, what am I missing? I am sure it's something obvious but I am not seeing it
1 2 3 4 5 6 7 8 9 10 11 12
for (int i=0;i<counter;i++)
{
if ((student[counter].getGPA>=min) && (student[counter].getGPA<=max))
{
cout<<setw(15)<<student[counter].getFirstName()<<"|"
<<setw(15)<<student[counter].getLastName()<<"|"
<<setw(8)<<student[counter].getStudentID()<<"|"
<<setw(3)<<student[counter].getCreditH()<<"|"
<<setw(4)<<student[counter].getGPA()<<"|" <<endl;
}
}
Mar 10, 2013 at 6:52pm UTC
Is .getGPA a function? If it is, you forgot the parentheses on line 3.
Last edited on Mar 10, 2013 at 6:53pm UTC
Mar 10, 2013 at 6:53pm UTC
You're not missing the &, you're missing the ():
(student[counter].getGPA>=min)
should be
(student[counter].getGPA()>=min)
Same problem with the comparison to max
Mar 10, 2013 at 6:54pm UTC
Ah see I knew it was something obvious, thank you
Mar 10, 2013 at 7:08pm UTC
Anyways when it meant you forgot the '&' it didn't mean by the '&&' part, but it meant it was thinking you wanted a pointer instead of a variable somewhere.
Topic archived. No new replies allowed.