C++ // size t2int* rotateleft(int a[], size_t len){345678return a;}Tester.cpp1#include 2using namespace std;3#include "arrays.h"int main(){int al[] = {10,13,14,10,10,8};auto len1...


C++


Write the function rotateLeft which shifts each element in the array left by one position, moving<br>the first element to the end. Return the modified array.<br>arrays.cpp<br>1<br>#include <cstddef> // size t<br>2<br>int* rotateleft(int a[], size_t len)<br>{<br>3<br>4<br>5<br>6<br>7<br>8<br>return a;<br>}<br>Tester.cpp<br>1<br>#include <iostream><br>2<br>using namespace std;<br>3<br>#include ", 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

Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here