I am trying to calculate the total cost per item (quantity * price) but my counter variable is giving me this error: Any help would be greatly appreciated! I used [i] like this earlier in my program so I am a bit confused.
"No operator "[]" matches these operands
operand types are Invoice[int]
1 2 3 4 5 6 7
void getCost(Invoice invoices, constint NUM_ITEMS)
{
for (int i = 0; i < NUM_ITEMS; i++)
{
double cost = invoices[i].getPrice() * invoices[i].getQuan();
}
}