Question: In C++.... 15 points Write a function that can swap the values of two variables. Use reference semantics so that the original variables that are
In C++....
15 points Write a function that can swap the values of two variables. Use reference semantics so that the original variables that are passed into the function are swapped. Starter Code: \#include string> \#include \#include random> int main() \{ int i=5; int j=7; std: : cout "i="i" "; std: : cout "j ="j" "; I/ TODO: write and call a function capable of swapping the values of ' i ' and ' j ' inplace. Implement the swap within the function itself, the only code you should add to main is the function call to your new swap function. i.e. swap(i,j); Sample Output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
