我已經做了一個基本的做while循環,我想輸出汽車租賃在左邊和右邊的屏幕voucherno。如果用戶想要重複這個過程,那麼憑證號應該增加1.另一件事是我有的表達式有什麼問題, 它表示期望在=標記之前的表達式。如何在C++中每次運行一個循環時將變量增加1?
do {
unsigned short voucherno=0;
char processanother;
cout<<"CAR HIRE"<<setw(4)<<setfill('0')<<"Voucher Number:"<<voucherno++;
cout<<"Repeat again to test the loop Y/N?";
cin>>processanother;
}
while(processanother!=='y'||process!=='Y');
使processanother外 「做,而」 與改變!==來!= – qwr
@qwr你的意思是'全球 – dkrikun