Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

vector<int> flatten(int a[100][200]); Write a function named \"flatten\" that ta

ID: 3552057 • Letter: V

Question

vector<int> flatten(int a[100][200]);

Write a function named "flatten" that takes a 2-dimensional array of integers with 100 rows and 200 columns and returns a vector that contains all of the array vector<int> flatten(int a[100][200]);

Write a function named "flatten" that takes a 2-dimensional array of integers with 100 rows and 200 columns and returns a vector that contains all of the array Write a function named "flatten" that takes a 2-dimensional array of integers with 100 rows and 200 columns and returns a vector that contains all of the array

Explanation / Answer

vector<int> flatten(int a[100][200])

{

vector<int > vec;

for(int i=0; i<100; i++)

{

    vec.insert(vec.end(), a[i], a[i]+200);

}

return vec;

}