do {
cout << "Quantity : ";
cin >> sale->quantity;
cout << "Unit Price: ";
cin >> sale->unitPrice;
cout << "Taxable : ";
cin >> sale->taxStatus;
} while (sale->quantity != 0);
当我输入0
forquantity
时,它仍然要求我输入unitPrice
and taxStatus
,然后它终止。我怎样才能让我的循环在quantity
输入后立即终止0
?
编辑
> echo "" | a.out
Sale Records
=============
Quantity : Unit Price: Taxable : Quantity : Unit Price: Taxable : Quantity : Unit Price: Taxable : Quantity : Unit Price: Taxable : Quantity : Unit Price: Taxable : Quantity : Unit Price: Taxable : Quantity : Unit Price: Taxable : Quantity : Unit Price: Taxable : Quantity : Unit Price: Taxable : Quantity : Unit Price: Taxable : >