I am trying to sort my array in descending order by Price. The array is data type "Invoice". I have never used an insertion sort (yes I have to for my assignment) so any help to guide me towards a solution would be great. Is the structure of my sort correct? Also, I have one error as of right now.
Error:
Severity Code Description Project File Line Suppression State
Error C2659 '=': function as left operand U14 c:\users\christian\source\repos\u14\u14\u14.cpp 105
void insertionSort(Invoice invoices[], constint NUM_ITEMS)
{
int i, j;
double key;
for (i = 1; i < NUM_ITEMS; i++)
{
key = invoices[i].getPrice();
j = i - 1;
/* Move elements of arr[0..i-1], that are
greater than key, to one position ahead
of their current position */
while (j >= 0 && invoices[j].getPrice() > key)
{
invoices[j + 1].getPrice = invoices[j].getPrice;
j = j - 1;
}
invoices[j + 1].getPrice = key;
}
}