O mágico troca dois copos de lugar. Escreva swap_cups(a, b) para que a e b troquem o que têm dentro. Os dois são referências, então depois left e right em after_swap também estão trocados.
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) {
// seu código aqui: troque a e b
}
string after_swap(string left, string right) {
swap_cups(left, right);
return left + " " + right;
}
Executar testa os exemplos. Quando parecerem certos, Enviar.