0

hello everyone, I am recieving this compiler error stating that

else if(input%100 || input%10 == rndNum%100 || rndNum%10)

this line ^

gives me the error

error: bad operand types for binary operator '||'

was hoping someone could explain this error to me if possible, also any advice would be greatly appreciated!

Thanks!!

2
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by picogenkaku
0

Try to make use of parentheses inside the condition. Determine first the logic of the condition before using logical operators.

You may mean in that code:

input % 100 OR input % 10 is equal to rndNum % 100 OR rndNum % 10.

It can be restructured by using parentheses.

inputTwo == input % 10;

(input % 100) OR (inputTwo == rndNum % 100) OR (rndNum % 10)

Give it a try! :)

0
error: bad operand types for binary operator '||'
        else if((input%100) || (input%10 == rndNum%100) || (rndNum%10)){
                            ^
  first type:  int
  second type: boolean
1 error

Edited by Dani: Formatting fixed

0

lol sry im an idiot, this is what i get when i drink gin while programming lol, thanks for input tho!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.