+ 1

C++ about variable. I don't understand how to do.

David and Alex each have aquariums. There are 8 Rainbowfishes in David’s aquarium, and 11 Angelfishes in Alex’s aquarium. Help them exchange their fishes between them. Complete the code to swap the values of variables between aquariumDavid and aquariumAlex. << Code >> #include <iostream> using namespace std; int main() { int aquariumDavid = 8; int aquariumAlex = 11; // your code goes here cout << "David's aquarium: " << aquariumDavid << endl; cout << "Alex's aquarium: " << aquariumAlex; return 0; } Help me pls. Orz

23rd Feb 2021, 3:14 AM
āļžāđˆāļ­āļĄāļ”āļ”āļģ āļ—āļĩāđˆāļ„āļĢāđˆāļēāļŠāļĩāļ§āļīāļ•āļ™āļąāļšāļžāļąāļ™āļ”āđ‰āļ§āļĒ āļĨāļđāļāļŠāļīāđ‰āļ™
āļžāđˆāļ­āļĄāļ”āļ”āļģ āļ—āļĩāđˆāļ„āļĢāđˆāļēāļŠāļĩāļ§āļīāļ•āļ™āļąāļšāļžāļąāļ™āļ”āđ‰āļ§āļĒ āļĨāļđāļāļŠāļīāđ‰āļ™ - avatar
3 Answers
+ 1
Hello For swapping you required a third variable. Please refer following code: https://code.sololearn.com/ca2A218A10A1
23rd Feb 2021, 4:18 AM
AjayGohil
0
Thanks you everyone so much âĢïļðŸ€âĢïļ
25th Feb 2021, 12:49 PM
āļžāđˆāļ­āļĄāļ”āļ”āļģ āļ—āļĩāđˆāļ„āļĢāđˆāļēāļŠāļĩāļ§āļīāļ•āļ™āļąāļšāļžāļąāļ™āļ”āđ‰āļ§āļĒ āļĨāļđāļāļŠāļīāđ‰āļ™
āļžāđˆāļ­āļĄāļ”āļ”āļģ āļ—āļĩāđˆāļ„āļĢāđˆāļēāļŠāļĩāļ§āļīāļ•āļ™āļąāļšāļžāļąāļ™āļ”āđ‰āļ§āļĒ āļĨāļđāļāļŠāļīāđ‰āļ™ - avatar