Says I forgot the '&' but I didn't???

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;
   }

}
Is .getGPA a function? If it is, you forgot the parentheses on line 3.
Last edited on
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
Ah see I knew it was something obvious, thank you
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.