Problem Set 1 #1. Make a function which can print out a two-dimensional array. #include #define RLENGTH 3 #define CLENGTH 2 using namespace std; void print2darray (int arg[][CLENGTH]) { /* Fill the blank */ } int main () { int firstarray[RLENGTH][CLENGTH] = {{3,4},{5,6},{7,8}}; int secondarray[RLENGTH][CLENGTH] = {{1,2},{3,4},{5,6}}; print2darray(firstarray); print2darray(secondarray); return 0; } #2. Make a function which is similar to 'map' in python 2.7 #include #define LENGTH 10 using namespace std; int * map( /*Fill the blank */ ) { static int p[LENGTH]; /* Fill the blank */ return p; } int twotimes (int n) { return 2 * n; } int main(void) { int a[] = {1,2,3,4,5,6,7,8,9,10}; int * b = map(twotimes, a); for(int i = 0; i < LENGTH; ++i) { cout << *(b + i)<< ", "; } return 0; } #3. Make a Transpose function