The magician swaps two cups around. Write swap_cups(a, b) so that a and b trade what's in them. Both are references, so afterwards left and right in after_swap have swapped too.
after_swap("ball", "empty")→'empty ball'after_swap("red", "blue")→'blue red'string after_swap(string left, string right)#include <string>
using namespace std;
void swap_cups(string &a, string &b) {
// your code here: swap a and b
}
string after_swap(string left, string right) {
swap_cups(left, right);
return left + " " + right;
}
Run tries the examples. When they look right, Submit.