Professional Documents
Culture Documents
11. Write a C++ program that defines a function void SWAPCOL(int ARR[][], int m , int n ) in
C++ to swap (interchange) the first column elements with the last column elements for the two
dimensional array passed as the argument to the function. The main function should accept an
array and finally display the swapped array after calling SWAPCOL().
Example If the two dimensional
array contains
2
1
4
9
1
3
7
7
5
8
6
3
7
2
1
2
12. Write a C++ program that defines a function void SWAPROW (int ARR[][], int m , int n ) in
C++ to swap (interchange) the first row elements with the last row elements for the two
dimensional array passed as the argument to the function. The main function should accept an
array and finally display the swapped array after calling SWAPROW ().
Example If the two dimensional
array contains
2
1
5
7
1
3
8
2
4
7
6
1
9
7
3
2
13. Write a program in C++ that creates a function which accepts an integer one dimensional array
and its size as arguments and assigns the elements into a two dimensional array of integers in
the following format:
If the array is 1, 2,3,4,5
The resultant 2D array should be:
1
1
1
1
1
2
2
2
2
0
3
3
3
0
0
4
4
0
0
0
5
0
0
0
0
14. Write a program in C++ that creates a function which accepts an integer one dimensional array
and its size as arguments and assigns the elements into a two dimensional array of integers in
the following format:
If the array is 1, 2,3,4,5
The resultant 2D array should be:
1
1
1
1
1
0
2
2
2
2
0
0
3
3
3
0
0
0
4
4
0
0
0
0
5