Where is the logical operator xor?

Asked 2 years ago, Updated 2 years ago, 57 views

Where is the logical operator xor?

// Return 1 when either A or B is 5
return (A==5) ^^ (B==5);

I want to write it like this, but there is no ^^ operator, but there is only a bit operator ^. There are &, &&, |, and | but how do I write ^^?

c++ logical-operator operator

2022-09-22 15:57

1 Answers

There is no logical ^^ but != does that

The fact that they'really? A != B To,

If the two are not the same bool value, !A != !B It has to be written as.

As you asked, if you want to return 1 when either A or B is 5, return (A==5) != (B==5) It has to be written as.


2022-09-22 15:57

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.