Please make sure to use C++ DO NOT USE anything else other than what it\'s askin
ID: 3744483 • Letter: P
Question
Please make sure to use C++
DO NOT USE anything else other than what it's asking please. ONLY arrays.
Given two arrays of integers A and B of sizes M and N respectively. Write a function named COMBINE (), which will produce a third array named C, such that the following sequence is followed: • All even numbers of A from left to right are copied into C from left to right. • All odd numbers of A from left to right are copied into C from right to left. • All even numbers of B from left to right are copied into C from left to right. • All old numbers of B from left to right are copied into C from right to left. Ex: A is {3, 2, 1, 7, 6, 3} and B is {9, 3, 5, 6, 2, 8, 10} the resultant array C is {2, 6, 6, 2, 8, 10, 5, 3, 9, 3, 7, 1, 3}
Explanation / Answer
#include using namespace std; void combine(int A[], int B[], int C[], int M, int N) { int len = M+N; int left_index = 0, right_index = len-1; for(int i = 0; iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.