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;
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.