Computer Science, asked by harishvermabaq, 1 year ago

How to use a "OR" condition in C++.
For example if we want to write " if nm = a or b or c " , then how we can write it ?

Answers

Answered by sandew
2
if((nm==a)||(nm==b)||(nm==c))
using this can able to complete ur program...

harishvermabaq: Sorry it's not working
sandew: now u try again
sandew: I have corrected
harishvermabaq: Thanks
sandew: welcome
Answered by Infraboy
3
if( (nm=='a') || (nm=='b') || (nm=='c') )

this would work is a,b,c are characters. if they are variables then,

if( (nm==a) || (nm==b) || (nm==c) )

harishvermabaq: Thank you
kvnmurty: very right. good answer
Similar questions