i need to write a program in C++ that contains a function that implements slicin
ID: 675477 • Letter: I
Question
i need to write a program in C++ that contains a function that implements slicing operations for 3- dimentional arrays. The following is a example of an accepatble function prototype:
template <typename T>
void SliceArray(T* arrayToSlice, , T* arrayToReturn, int lowerBound_dim1, int upperBound_dim2, int lowerBound_dim2, int upperBound_dim2, int lowerBound_dim3, int upperBound_dim3);
The function receives the array to slice and six integer parameters: the lower and the upper bounds for each of the three dimensions. The function returns the array of appropriate dimensions, representing the result of the slicing operation. my program needs not error check parameters for correct ranges. and to write a comprehensive and interactive driver program that allows the user to test the performance of your slicing function.
Explanation / Answer
The program for slicing of 3 Dimensional Arrays is as follows:
Output:
Enter 12 values: 1
2
3
4
5
6
7
8
9
10
11
12
Displaying Value stored:
test[0][0][0] = 1
test[0][0][1] = 2
test[0][1][0] = 3
test[0][1][1] = 4
test[0][2][0] = 5
test[0][2][1] = 6
test[1][0][0] = 7
test[1][0][1] = 8
test[1][1][0] = 9
test[1][1][1] = 10
test[1][2][0] = 11
test[1][2][1] = 12
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.