Where is the logical operator xor?

Asked 1 years ago, Updated 1 years ago, 48 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.