+ 2

How to write a program in c++ to swap two numbers using a function i.e swap plz help...

29th Oct 2017, 9:28 AM
Shivam Patil
5 Answers
+ 8
1) use a third variable 2) a = (a+b) - (b=a); 3) a=a+b; b=a-b; a=a-b; 4) std::swap(a,b);
29th Oct 2017, 9:46 AM
Kamil
Kamil - avatar
+ 1
where is cout statement?? this program can not print the newly swaped value ::yash thatthe
30th Oct 2017, 12:54 PM
Shivam Patil
0
oh ez
19th Nov 2017, 6:54 AM
dsmrphn
dsmrphn - avatar