0
What happens if i put && and || together.?
for example see this code: if (a>b || a==b && b>c) so how does it interpret it.... so will it be true when either a>b or a= b along with b being greater than c.... or will it be true either if only a>b or if both a=b and b>c??? or can i use parenthesis to group them???
2 Answers
+ 1
Google c++ operators precendence. If you don't know which ones have higher precendence you can just use parentheses.
a > b || a == b && b > c would be interpreted as:
(a > b) || ((a == b) && (b > c))
- 2
it just depend on the input you give for the respective variable...for example, if you assign value of 20 to variable 'a', 15 to 'b' & 10 to 'c', then the output will be a>b & b>c.