C++ stuck in while loop -


hello doing simple while loop in c++ , can not figure out why stuck in when proper input give.

string itemtype = "";         while(!(itemtype == "b") || !(itemtype == "m") || !(itemtype == "d") || !(itemtype == "t") || !(itemtype == "c")){             cout<<"enter item type-b,m,d,t,c:"<<endl;             cin>>itemtype;             cout<<itemtype<<endl;         }         cout<<itemtype; 

if can point out on looking i'd appreciate it. suppossed exit when b,m,d,t or c entered.

your problem in logic. if @ conditions while loop, loop repeat if item type not "b" or not "m" or not "d" etc. means if item type "b", not "m", repeat. want use && instead of ||.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -