Write c++ code for the following questions using functions 2D ARRAY PLEASE DO AT
ID: 3717842 • Letter: W
Question
Write c++ code for the following questions using functions 2D ARRAY PLEASE DO ATTEMPT ONLY IF YOU COULD SOLVE THE THREE QUESTIONS
2D Arroy, Functions & Graphics Question 1 Declare and Initialize a 2D array of 33 matrix. E. 9. Check if the matrix is symmetric or not Question 2: Pass a 2D array to a function named printAIK and access print all its elements. Question 3: Write a function named detectDiamandthat lakes in a 2D array and checks i il conlains diamond of same elements. For example InputExplanation / Answer
bool check_Symmetric(int data[][]){
bool ans;
data[3][3] = {{1,2,3},
{4,5,6},
{7,8,9}
};
for (int i = 0; i<3; i++){
for (int j = 0; j<3; j++){
if (data[i][j] != data[j][i]){
return false;
}
}
}
return true;
}
void print(int data[][], int n){
bool ans;
data[3][3] = {{1,2,3},
{4,5,6},
{7,8,9}
};
for (int i = 0; i<n; i++){
for (int j = 0; j<n; j++){
cout << data[i][j] << " ";
}
cout << endl;
}
}
bool detectDiamond(int data[][], int m, int n){
if (data[m/2][0] == data[m/2][n-1] &&
data[m/2][0] == data[0][n/2] &&
data[m/2][0] == data[m-1][n/2])
return true;
else
return false;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.