MENU
Question -

Write definition for a function DISPMID (int A[][5], int R, int C) in C+ + to display the elements of middle row
and middle column from a two dimensional array A having R number of rows and C number of columns.
For example, if the content of array is as follows:

215 912 516 401 515
103 901 921 802 601
285 209 609 360 172
The function should display the following as output:
103 901 921 802
601 516 921 609



Answer -

void DISPMID (int A[] [5] , int R, int C)
 {
 int mid = (R+C)/2;
 for (int i=0; i
 {
 Cout << A[mid] [i]<<"";
 } cout<
 for (int i=0; i
 cout << A[i][mid]<<"";
 }

Comment(S)

Show all Coment

Leave a Comment

×