error: expression cannot be used as a function

Hello all, I made a gueesing number program and I had a error just 3 lines of it. I could not find the mistake.

1
2
3
4
5
6
7
8
9
10
  else if (((userNumberDigits[3]==numberDigits[2]) && 1) || ((userNumberDigits[3]==numberDigits[1]) && 1) || ((userNumberDigits[3]==numberDigits[0])&& 1)
         ((userNumberDigits[0]==numberDigits[3]) && 1) || ((userNumberDigits[0]==numberDigits[2]) && 1) || ((userNumberDigits[0]==numberDigits[1])&& 1)
         ((userNumberDigits[2]==numberDigits[3]) && 1) || ((userNumberDigits[2]==numberDigits[1]) && 1) || ((userNumberDigits[2]==numberDigits[0])&& 1)
         ((userNumberDigits[1]==numberDigits[3]) && 1) || ((userNumberDigits[1]==numberDigits[2]) && 1) || ((userNumberDigits[1]==numberDigits[0])&& 1)
            )
        {
            cout << "-1" << endl;
            counter = counter + 1;
        }
What is the error?

Also, doing <anything> && 1 is just redundant. x && 1 == x.
Last edited on
error is elsewhere. this part checks out ok. Probably a borked {} pair or () pair above it, or possibly a ;
Error is "error: expression cannot be used as a function.

Thank you for your information, I know it, I did it because i tried to solve the error and it gave same error.
When I cut this part the code has zero error .
You're missing || between each line. (I assume you want ||, perhaps you want &&)
Last edited on
Oh god. I see now. Thank you for your help. Now I have zero error.
Topic archived. No new replies allowed.