無論輸入是否正確,下面的代碼都不起作用。如果輸入正確,則if語句仍會因某種原因而執行。任何快速建議都會有所幫助。C++簡單字符檢查
char status;
cout<<"Please enter the customer's status: ";
cin>>status;
if(status != 'P' || 'R')
{
cout<<"\n\nThe customer status code you input does not match one of the choices.\nThe calculations that follow are based on the applicant being a Regular customer."<<endl;
status='R';
}