Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This has to do with writing functions... Write a function called matrixAdd1 that

ID: 3544998 • Letter: T

Question

This has to do with writing functions... Write a function called matrixAdd1 that adds 1.0 to each element  of a matrix of doubles . An initial function skeleton is provided --- your job is to write the body of the function. Note that the matrix M has numRows rows and numCols columns, which are passed as parameters  to the function. The function should NOT return a value , and should not use cout  nor cin.


Instructor's notes: When writing functions, pretend you are writing a code fragment, and declare any additional variables that you need.

Explanation / Answer

Since you didn't give the skeleton of the function i'll just have to assume from other questions you've posted.


void matrixAdd1(double M[MAXROWS][MAXCOLS], int numRows, int numCols){

double temp;

for(int i = 0; i < numRows; i++){

for(int j = 0; j < numCols; j++){

M[i][j] += 1.0;

}

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote