Question: Write a C++ program that passes the given test cases while following OOP concepts only. Test Case: TEST(rotateArray, rotate1) { int arr[] = {1,2,3,4,5,6}; int

Write a C++ program that passes the given test cases while following OOP concepts only.

Test Case:

TEST(rotateArray, rotate1) {

int arr[] = {1,2,3,4,5,6};

int a[] = {2,3,1,5,6,4};

int *arr1 = rotateArray(arr, 6, 2, 2);

for (int i = 0; i

ASSERT_EQ(a[i], arr1[i]);

}

}

TEST(rotateArray, rotate2) {

int arr2[] = {1,4,3,11,7,9,5,10,12,6,2,8};

int a1[] = {4,3,11,1,9,5,10,7,6,2,8,12};

int *arr3 = rotateArray(arr2, 12, 3, 3);

for (int i = 0; i

ASSERT_EQ(a1[i], arr3[i]);

}

}

Write a C++ program that passes the given test cases while following

Write a function named as rotateArray that takes an array of type integer, its size, input n whichshifts elements of an array to the right n times, and a number m which divide array into m partsas function parameters. You first need to need to divide array into m number of parts and then shifts elements of an array to the right n times. Array under consideration is circular. Function Prototype: rotateArray (int *arr, int sizeofArray, int n, int m ) Original Array Updated Array ( n=2 and m=2 )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!