do {
cout << "Quantity : ";
cin >> sale->quantity;
cout << "Unit Price: ";
cin >> sale->unitPrice;
cout << "Taxable : ";
cin >> sale->taxStatus;
} while (sale->quantity != 0);
Run Code Online (Sandbox Code Playgroud)
当我进入0了quantity,但它仍然要求我要unitPrice和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 : >
Run Code Online (Sandbox Code Playgroud)
当质量为0时,你试过告诉它终止吗?
cin >> sale->quantity;
if (sale->quantity == 0) break;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2954 次 |
| 最近记录: |