Question: In C++ P6.9 Write a function bool equals(int a[], int a_size, int b[], int b_size) that checks whether two arrays have the same elements in
In C++
![In C++ P6.9 Write a function bool equals(int a[], int a_size, int](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f5108ebcc0a_59066f5108e6c1ff.jpg)
![b[], int b_size) that checks whether two arrays have the same elements](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f5108fb1ae3_59166f5108f1c605.jpg)

P6.9 Write a function bool equals(int a[], int a_size, int b[], int b_size) that checks whether two arrays have the same elements in the same order. 1. Please prompt the user for two arrays that are identical and your program produces the message claiming, Both arrays are the same. Please print each element of these two arrays first and a message follows. 2. Please prompt the user for two arrays that are different and your program produces the message claiming, Two arrays are different. Please print each element of these two arrays first and a message follows. 3. Each array should contain at least 10 elements. Both arrays can have a capacity of 20 elements. So, you should declare A[20] and B[20] to implement this exercise. Your program does not know how many elements contained in each array. Therefore, each array should have a current_size to assist in processing the array. 4. Your program should contain the following function: Bool equals(int a[], int a_size, int b[], int b_size) Based on the return value, a propriate message will be generated. Test cases: 1. Array A = {1,4, 9, 16, 9, 7,4,9,7} Array B = {1,4, 9, 16, 9, 7, 4, 9, 7} Message: Size of Array A = 9 Size of Array B = 9 Both arrays are the same" 2. Array A = {1,4, 9, 16, 9, 7,4,9,7} Array B = {1,4, 9, 16, 9, 7,4,9,7,8} Message: Size of Array A = 9 Size of Array B = 10 "Two arrays are different" 3. Array A = {1,4, 9, 16, 9, 7,4,9,7} Array B = {7,9,4,7,9, 16, 9, 4, 1} Message: Size of Array A = 9 Size of Array B = 9 "Two arrays are different" 4. Array A = {1,4, 9, 16, 9, 7, 4, 9, 7, 8} Array B = {1,4, 9, 16, 9, 7, 4, 9, 7} Message: Size of Array A = 10 Size of Array B = 9 Two arrays are different
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
