Use C++ to Code!! | 1633432+ ttu.blackboard.com Frank Sinatra- LO.V.E.( ### Welc
ID: 3601835 • Letter: U
Question
Use C++ to Code!!
| 1633432+ ttu.blackboard.com Frank Sinatra- LO.V.E.( ### Welcome to the ECE-1305 Homepage ###-201827-ECE-… 303545 the TA or the instructor 1) What is the output of the following program? Explain your results. Where do the numbers come from? #include «iostream» using namespace std; const int SIZE=3; void funct (int M [SIZE],int SIZE, int& num1, int& num2); int main int A1,A2,B1, B2; int A[SIZE] [SIZE]={{10,2,3},(-6,5,3},{7, 15,-3)); int B[SIZE] [SIZE]={{-15,6,-12),(-4,8,7},{6,-7,11)); funct (A, SIZE,A1,A2); funct (B, SIZE, B1,B2); return 0; void funct (int M[][SIZE],int SIZE, int& numl, int& num2) num1=0; num20; for (int i=0;iExplanation / Answer
Its very Simple The output of this code is
12 24
4 -4
because in this we are calling the function funct in which we pass an array
its size and 2 integers .
in the function the first integer stores the sum of all the elements which
have i and j same in the matrix such as 1,1 2,2 3,3 etc. so in A1 all the diagonal elements sum isb stored and
in A2 the remaining elements are stored so from first array A its diagonal elements sum is 12 and the remaining element sum is
stored in A2 24 is stored similarly it is done for the second function call.
we have matrix A= 10 2 3
-6 5 3
7 15 -3
so A1=10+5+(-3)=12
A2=2+3+3+(-6)+7+15=24
for matrix B= -15 6 -12
-4 8 7
6 -7 11
B1=-15+8+11=4
B2=6+(-12)+(-4)+7+6+(-7)=-4
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.