The following is an insert sorting algorithm that is part of a larger program.
I have refined this program to the point that I only get this one error.
1 2 3 4 5 6 7 8 9 10 11 12
for (int Next = 1; Next < increment; ++Next)
Insert = People[Next];
int MoveItem = Next;
while ((Next > 0) && ((People[Next-1]) > (Insert))) // Error: No match for 'operator>' in "People[Next-1] > Insert", where operator> reffers to the logical operator ">" between Next-1 and Insert.
People[MoveItem] = People[MoveItem-1];
People[MoveItem] = Insert;
This problem has got me stumped. I cannot figure out why such an operator would not be valid. Also, as a side note, replacing ">" with "<" makes the error read "No match for 'operator "<"...", so it is not the type of operator that is the problem.
Any help on this is much appreciated, as I have already gone to office hours once, and gotten help from a friend.