1
Swap Two Numbers
Problem Solving
Viva te 'swap without 3rd variable' khub jigges kore. Real code e std::swap use korbe.
int a = 10, b = 20;
int temp = b;
b = a;
a = temp;
a = a + b;
b = a - b;
a = a - b;
a = a ^ b;
b = a ^ b;
a = a ^ b;
int a = 10, b = 20;
swap(a, b);
Note: swap() needs #include <utility> and #include <algorithm>.