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!!

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! :)

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

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

Substitute input % 10 to inputTwo and try it again.

It's nothing dude. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.