Please use [code][/code] tags when posting code
(Fixed)
purchaseTable wasn't declared in the scope of displayRecords.
That could be fixed by having that function getting as argument a purchaseType*: void displayRecords(purchaseType *purchaseTable) and remember to pass purchaseTable in main
line 55:
binary '[' : 'purchaseType' does not define this operator or a conversion to a type acceptable to the predefined operator
and
left of '.salesAmt' must have class/struct/union
line 56:
binary '[' : 'purchaseType' does not define this operator or a conversion to a type acceptable to the predefined operator
and
left of '.totalAmt' must have class/struct/union
line 58:
binary '[' : 'purchaseType' does not define this operator or a conversion to a type acceptable to the predefined operator
and
left of '.salesAmt' must have class/struct/union
line 59:
binary '[' : 'purchaseType' does not define this operator or a conversion to a type acceptable to the predefined operator
and
left of '.totalAmt' must have class/struct/union
i have done some read and even change the code to:
1 2 3 4 5 6 7 8 9 10 11 12
void displayRecords(purchaseType tempTable)
{
for (int i = 0; i < maxRecord; i++)
{
double num;
num = computeTotal(tempTable[i].salesAmt);
tempTable[i].totalAmt = floor(num*10.0)/10.0;
cout << fixed << setprecision(2) << "Sales Amount: "
<< tempTable[i].salesAmt << " and Total Amount: "
<< tempTable[i].totalAmt << endl;
}
}
You should use a pointer as argument type if you are passing an array.
You can pass purchaseTable as any other argument displayRecords( purchaseTable );