if (sale->taxStatus[i] = "y") // line 44
エラーが発生します:
y.cpp:44:12: error: request for member taxStatus in sale, which is of non-class type Sale*
私の構造体:
struct Sale {
int quantity[MAX_SALES];
float unitPrice[MAX_SALES];
char taxStatus[MAX_SALES]; // MAX_SALES = 10
};
完全な機能:
void total(struct Sale sale[], int sales) {
int i = 0;
float subTotal, hst, total = 0;
for (i = 0; i < sales; i++) {
subTotal = subTotal + (sale->quantity[i] * sale->unitPrice[i]);
if (sale->taxStatus[i] = "y")
{
hst = hst + ((sale->quantity[i] * sale->unitPrice[i]) * 0.13);
}
}
cout << "\n" << "Subtotal : " << subTotal << endl;
cout << "HST (13%) : " << hst;
}