do {
cout << "Quantity : ";
cin >> sale->quantity;
cout << "Unit Price: ";
cin >> sale->unitPrice;
cout << "Taxable : ";
cin >> sale->taxStatus;
} while (sale->quantity != 0);
当我进入0
为quantity
,但它仍然要求我要unitPrice
和taxStatus
,然后将其终止。如果quantity
输入的是0
,我怎么能让我的环路终止?c + +停止做while循环,一旦条件满足
编辑
> 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 : >
当您说'echo“时,您的程序是否工作? 。/ prog'? –
是的,它工作,它吐出了很多值,我已经更新OP。 – eveo
这是正确的行为吗?即你希望它如何表现? –