hi guys i have an issues with my project. I have declared an 2darray filled it with random numbers and there is a task wehere I have to add to each element on the periphery of the matrix a number entered from the keyboard. BTW matrix is 10x7(rowXcolumns).
for (int i = 0; i < m; i++){
matrix[0][i] = matrix[0][i]+c;
for (int j = 0; j < n; j++){
matrix[j][0] = matrix[j][0]+c;
}
}
here is the code but it isnt working...Thanks for help "
void plusCOnPeriphery(int matrix[M][N], int m, int n, int c){
for (int i = 0; i < m; i++){
matrix[0][i]+=c;
for (int j = 0; j < n; j++){
matrix[j][0] +=c;
}
}
}
1 2 3 4 5 6 7 8
void replaceRowWithArray(int matrix[M][N], int m, int n, unsignedshort R, int newRow[N]){
for (int i = R; i == R; i++){
for (int j = 0; j < n; j++){
matrix[i][0] = newRow[N];
}
}
}
at the first function i have to add entered number C to the periphery of the matrix
second funcition entered number R represents a single row in a matrix which i have to change with a new row (newRow[])
guys how do I replace a row in a matrix with another array ?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
void replaceRowWithArray(int matrix[M][N], int m, int n, unsignedshort R, int newRow[N]){
for (int i = R; i == R; i++){
for (int j = 0; j < n; j++){
matrix[i][0] = newRow[N];
}
}
}