CJCoding With Joseph
15free / daySign inCreate account

Swap Two Arrays

The code already creates array<int, 3> a = {1, 2, 3}; and array<int, 3> b = {4, 5, 6};.

Swap the contents of a and b with a single call to the swap member function (no element-by-element loop), then print both arrays: the first line is the text a: followed by a space and the elements of a separated by spaces; the second line is b: followed by a space and the elements of b.

Expected Output:

a: 4 5 6
b: 1 2 3

= newline. The output ends with a newline — print one after the last line.

Hints4 available
Topics:
STL Containersstd::array
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.