一旦满足条件,C++就会停止while循环

eve*_*veo 0 c++

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)

当我进入0quantity,但它仍然要求我要unitPricetaxStatus,然后将其终止.一旦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)

Lil*_*ard 5

当质量为0时,你试过告诉它终止吗?

cin >> sale->quantity;
if (sale->quantity == 0) break;
Run Code Online (Sandbox Code Playgroud)