77///////////////////// 7. In mathematics, two compatible matrices can be added together to form a third matrix. A matrix may be represented by a two dimensional array of integers. To add two matrices...


See attached images


Study Guide


C++


9.


77/////////////////////<br>7. In mathematics, two compatible matrices can be added together to form a third<br>matrix. A matrix may be represented by a two dimensional array of integers. To add<br>two matrices together, corresponding elements are added to get the corresponding<br>element in the result, as illustrated below:<br>2 1 2<br>+ 2 5 2<br>1<br>3<br>1<br>3<br>4<br>3<br>4 2<br>3<br>7<br>5<br>4<br>2<br>3 8<br>4<br>9 12<br>6<br>Define a function named add that will handle adding two matrices. You must decide<br>an appropriate interface for this function and define the function below. The function<br>only needs to work for 10 x 10 arrays. You must use loops in your solution. Show the<br>function definition below.<br>8. Let's say we have a one dimensional array of integers. We want a function that will<br>calculate the average of the values in the array. Decide an appropriate interface for<br>this function and define the function below.<br>9. The following function is supposed to calculate basexP, where base and exp are<br>positive integers. Given what this function does, it is poorly designed and the<br>interface to the function is messed up (it works, it's just really awkward).<br>a) Show a code segment below that would call this function (as defined below) to<br>calculate 34.<br>void power (int &base, int &exp, int& result)<br>{<br>result<br>1;<br>for( ; ехp > 0; еxр--)<br>result<br>result * base;<br>}<br>b) Fix the interface so the function is easier to use. Show the corrected function<br>definition below.<br>

Extracted text: 77///////////////////// 7. In mathematics, two compatible matrices can be added together to form a third matrix. A matrix may be represented by a two dimensional array of integers. To add two matrices together, corresponding elements are added to get the corresponding element in the result, as illustrated below: 2 1 2 + 2 5 2 1 3 1 3 4 3 4 2 3 7 5 4 2 3 8 4 9 12 6 Define a function named add that will handle adding two matrices. You must decide an appropriate interface for this function and define the function below. The function only needs to work for 10 x 10 arrays. You must use loops in your solution. Show the function definition below. 8. Let's say we have a one dimensional array of integers. We want a function that will calculate the average of the values in the array. Decide an appropriate interface for this function and define the function below. 9. The following function is supposed to calculate basexP, where base and exp are positive integers. Given what this function does, it is poorly designed and the interface to the function is messed up (it works, it's just really awkward). a) Show a code segment below that would call this function (as defined below) to calculate 34. void power (int &base, int &exp, int& result) { result 1; for( ; ехp > 0; еxр--) result result * base; } b) Fix the interface so the function is easier to use. Show the corrected function definition below.
Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here