C++
", al, len1); print("after al: ", rotateLeft(al, len1), len1); cout « "Expected: [13, 14, 10, 10, 8, 10]" « endl; cout « endl; 4 5 6. 7 10 11 12 13 int a2[] = {3,9,9,5}; auto len2 = sizeof(a2) / sizeof(a2[0]); print("before a2->", a2, len2); print("after a2: ", rotateLeft(a2, len2), len2); cout « "Expected: [9, 9, 5, 3]" « endl; } 14 15 16 17 18 19 CodeCheck Reset "/>
Extracted text: Write the function rotateLeft which shifts each element in the array left by one position, moving the first element to the end. Return the modified array. arrays.cpp 1 #include
// size t 2 int* rotateleft(int a[], size_t len) { 3 4 5 6 7 8 return a; } Tester.cpp 1 #include 2 using namespace std; 3 #include "arrays.h" int main() { int al[] = {10,13,14,10,10,8}; auto len1 = sizeof(al) / sizeof(al[0]); print("before al->", al, len1); print("after al: ", rotateLeft(al, len1), len1); cout « "Expected: [13, 14, 10, 10, 8, 10]" « endl; cout « endl; 4 5 6. 7 10 11 12 13 int a2[] = {3,9,9,5}; auto len2 = sizeof(a2) / sizeof(a2[0]); print("before a2->", a2, len2); print("after a2: ", rotateLeft(a2, len2), len2); cout « "Expected: [9, 9, 5, 3]" « endl; } 14 15 16 17 18 19 CodeCheck Reset