C++ Can someone help me with this problem? I have been trying it but it still doesn't work. Thank you // size t for sizes and indexes2using namespace std;34/////// WRITE YOUR FUNCTION BELOW THIS...


C++


Can someone help me with this problem? I have been trying it but it still doesn't work.


Thank you


1<br>#include <cstddef> // size t for sizes and indexes<br>2<br>using namespace std;<br>3<br>4<br>/////// WRITE YOUR FUNCTION BELOW THIS LINE<br>///<br>int appendEvens (const int a1[], int a2[], size_t sizel, size_t& size2)<br>7<br>int result;<br>// Add your code here<br>return result;<br>}<br>9.<br>10<br>11<br>CodeCheck<br>Reset<br>Testers<br>Running Tester.cpp<br>fail fail fail fail fail fail fail fail fail fail pass pass fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail<br>Testing Append Evens<br>appendEvens ( [21, 38, 32, 49, 12, 35, 45, 52], [], sizeA, sizeB)-><br>Returned: 0<br>Expected: 4<br>Array: []<br>Expected: [38, 32, 12, 52]<br>Size: 0<br>Expected: 4<br>

Extracted text: 1 #include // size t for sizes and indexes 2 using namespace std; 3 4 /////// WRITE YOUR FUNCTION BELOW THIS LINE /// int appendEvens (const int a1[], int a2[], size_t sizel, size_t& size2) 7 int result; // Add your code here return result; } 9. 10 11 CodeCheck Reset Testers Running Tester.cpp fail fail fail fail fail fail fail fail fail fail pass pass fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail fail Testing Append Evens appendEvens ( [21, 38, 32, 49, 12, 35, 45, 52], [], sizeA, sizeB)-> Returned: 0 Expected: 4 Array: [] Expected: [38, 32, 12, 52] Size: 0 Expected: 4
Write the function appendEvens() which, given two arrays, adds all of the even elements from the first to the<br>second. You may assume the second has enough space.<br>The function takes 4 arguments:<br>array 1 which may not be modified<br>array 2 which may be modified<br>size 1 which is not modified<br>size 2 with is modified<br>The function returns the number of items appended, or -1 if the first array is empty.<br>Here's an example:<br>const int MAX = 100;<br>int al[MAX]<br>int a2[MAX] = {7, 9};<br>size t size2 =<br>int appended = appendEvens (al, a2, 3, size2); // 1 appended<br>// After: size2->3, a2->[7, 9, 2]<br>{1, 2, 3};<br>2;<br>%3D<br>

Extracted text: Write the function appendEvens() which, given two arrays, adds all of the even elements from the first to the second. You may assume the second has enough space. The function takes 4 arguments: array 1 which may not be modified array 2 which may be modified size 1 which is not modified size 2 with is modified The function returns the number of items appended, or -1 if the first array is empty. Here's an example: const int MAX = 100; int al[MAX] int a2[MAX] = {7, 9}; size t size2 = int appended = appendEvens (al, a2, 3, size2); // 1 appended // After: size2->3, a2->[7, 9, 2] {1, 2, 3}; 2; %3D
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here