CJCoding With Joseph
15free / daySign inCreate account

Rotate Left by One

Write a function void rotateLeft(array<int, 5>& a) that moves every element one position to the left, and moves the element that was at index 0 to the end. Modify the array in place; there is no return value.

The test calls your function and prints the elements separated by spaces on one line. For {1, 2, 3, 4, 5} it prints the output shown in Expected Output.

Do NOT write a main function.

Expected Output:

2 3 4 5 1
9 9 1 2 9

= 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.