Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
That's it, that's
it
int x = 1984;
int y = 2001;
string binaryX = Convert.ToString(x, 2);
string binaryY = Convert.ToString(y, 2);
Console.WriteLine("binaryX = " + binaryX + "; binaryY = " + binaryY);
x ^= y ^= x = y;
Console.WriteLine("x = " + x + "; y = " + y);
int a;
Console.WriteLine(a = 3);
Do you have a typo there?
It looks a lot like exchanging values via XOR, which, according to the insidious idea of the author of the question (from the textbook?), should have been confusingly the following:
x ^= y
y ^= x
x ^= y
After these three operations, x and y will exchange values
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question