void shop::Pay(){
if (basket == NULL)
return;
float sum = 0.0;
float sum_tax = 0.0;
for (i = 0; &basket[i] != NULL; i++)
{
basket[i].GetPrice();
sum_tax += basket[i].tax;
sum += basket[i].at_price;
}
cout << sum_tax << endl;
cout << "Total:" << sum << endl;
return;
}
void goods::GetPrice(){
if (this == NULL)
return;
float rate = 0.1f;
if (isExempt)
rate -= 0.1f;
if (isImported)
rate += 0.05f;
tax = count*price*rate;
at_price = count*price+tax;
cout << count << " " << name << ":" << at_price << endl;
}
在GetPrice执行第三次时报错,这是栈溢出吗?应该怎么改?虚心求教!