Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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++
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 differentStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started