I need to compare an array within a class by using overloaded operator <.
It is within the bubble sort part of it. I have put in the friend bool operator, but can´t figure out how to make it work.
The class defines the < comparison operator (the less-than operator) that returns true if the first fraction is less than the second fraction (that is, a/b < c/d), but false otherwise.
Sorry for that.
The problem is with the friend bool operator <, and line 71.
I am not sure how to pass the arrays into it for it to be compared in there.
As it is now in line 17 and 71, as you point out, it´s not working.
What is it you actually want that operator to compare? It looks like it's not supposed to be comparing two arrays, but two Fraction objects. That's how you're using it at line 38, correct?
Who can say - the problem might be in the part of the code that was edited out. I suggest you post the actual version of the code which is giving you the current problem.
Ok, the problem was with the input to begin with. Line 70 and 75. I changed it to return instead of cin.
But it seems that there is alot of work for me to do here to fix this.