how to remove the input of a matrix, with a declared one with values #include using namespace std; int main() { int n; cout > n; int M[n][n] = { cout > M[i][j]; } cout


how to remove the input of a matrix, with a declared one with values



#include


using namespace std;


int main()


{


int n;



cout < "enter="" the="" order="" of="" the="" matrix:="">


cin >> n;



int M[n][n] = {



cout < "enter="" the="" elements="" of="" the="" matrix:="">


for(int i=0; i


{


for(int j = 0; j


cin >> M[i][j];


}



cout < "the="" matrix:="">


for(int i=0; i


{


for(int j = 0; j


cout < m[i][j]=""><>


cout <>


}



int temp;



for(int i=0; i


{


if((i+1) %2 != 0)


{


for(int j=0; j


{


for(int k=j+1; k


{


if(M[i][j] <>


{


temp = M[i][j];


M[i][j] = M[i][k];


M[i][k] = temp;


}


}


}


}


else


{


for(int j=0; j


{


for(int k=j+1; k


{


if(M[i][j] > M[i][k])


temp = M[i][j];


M[i][j] = M[i][k];


M[i][k] = temp;


}


}


}


}


}



cout < "the="" required="" matrix:="">


for(int i=0; i


{


for(int j = 0; j


cout < m[i][j]=""><>


cout <>


}


return 0;


}





Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here