answersLogoWhite

0

A proper flow chart for that purpose can't be depicted here, but the code would work as follows:

Given the two numbers, A and B:

C = A;

A = B;

B = C;

~if~ the numbers are integers, longs, or other types on which you can use an XOR operator (ie. not floats, doubles, etc.), then you could also do it this way:

A ^= B;

B ^= A;

A ^= B;

That is because of the way the binary XOR works. For example, let's say "A" is equal to to 12 and "B" is equal to 7:

A = 1100

B = 0111

If you run through those operations:

first A ^= B, now:

A = 1011

B = 0111

Now B ^= A:

A = 1011

B = 1100

and again, A ^= B:

A = 0111

B = 1100

or in decimal, A now equals seven, and B now equals twelve. Again, this will only work with fixed point values such as integers. You can't use it on floats.

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

Example of flowchart of while loop in c plus plus?

kk


What are the 6 typical c plus plus Development environment and phases?

Design, flowchart, encode, compile, test and debug.


What type of algebra tile model would you draw for 5x plus 15 plus 6x plus 7 plus x?

Sorry, it's impossible to draw with a keyboard!


How much do I get if I win 2 numbers plus bonus on Lotto?

It will depend on the prize fund for the draw that you have a winning ticket for.


How do you draw in Dev c plus plus?

Download and install the WinBGIM Devpack. Once installed, you can include graphics.h to draw graphics.


What will be the Flowchart for adding all elements in an array in c plus plus?

It is not possible to show a flowchart in this website -- it is text only. The algorithm can be summarised as follows: int sum(std::array<int>& a) { int sum = 0; // initialise the return value for (auto i : a) // for each value in the array sum += i; // increment the sum by the value return sum; // return the sum }


What is the mean of 70 plus 70 plus 70 plus 10 plus 10 plus 8 plus 4 plus 18 plus 5 plus 40?

The mean of a set of numbers is the average. That is to say, all the numbers added together and divided by the number of the numbers. the answer is 30.5


What numbers are most likely to win in Trinidad and Tobago Lotto Plus Draw?

Six. Six numbers, between one and one hundred, are MOST likely to win, on a regular basis. Pick six sets of numbers between one and one hundred and you are SURE to be the NEXT WINNER. Call me!


What are signed numbers?

Signed numbers are "plus" and "minus" numbers.


How would you graff x plus y equals -3?

Graph any two numbers that add together and get -3. Like, (5,-8) (0,-3) and then draw a line through them.


If 1 plus 3 plus 5 plus 7 plus 9 plus 11 plus 13 plus 15 plus 17 plus 19 equals 100 then choose 5 numbers from this whose sum is 50?

impossible, they are all odd numbers, 5 x odd numbers will equal an odd number


What do you win if you have two numbers and the mega b all?

If you have two regular numbers and the Mega Ball in a Mega Millions lottery draw, you win a prize. The amount can vary depending on the specific draw and the total number of winners, but typically, this prize is a fixed amount. As of recent rules, you usually win $10 for matching two numbers plus the Mega Ball. Always check the official lottery rules for the most accurate and current information.