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

i am having trouble with writing this code. I am in a beginning C plus plus clas

ID: 3713284 • Letter: I

Question

i am having trouble with writing this code. I am in a beginning C plus plus class. We are studying arrays and i am using Microsoft Visual Studios. with #include<iostream>,#include<iomanip>,#include<cmath>. I have to use arrays in order to write the code. thank u
thank you

4. Write a program that reads in a 3 X 3 square matrix and prints out the determinant of the matrix. +c (d h-e g h i 5. Write a program that reads in three matrices A, B and C and calculates the following 0 32 0 2 2* A +3*B

Explanation / Answer

Q1: Following program will print determinant.

#include<iostream>

using namespace std;

void main()

{

int m[3][3]; // store the matrix in 2 dimensional array

int result; // It will store the determinent value

cout<<"Enter the matrix "<<endl;

for(int i=0; i<3; i++) // input the matrix

for(int j=0; j<3; j++)

cin>>m[i][j];

result=m[0][0]*((m[1][1]*mm(2,2) )- (m(1,2)*m(2,1))) - m(0,1)*((m(1,0)*m(2,2)) - (m(1,2)*m(2,0))) + m(0,2)*((m(1,0)*m(2,1)) - (m(1,1)*m(2,0)));

cout<<"The determinent value is : " <<result; //This will print determinant value

return 0;

}

Q2: Calculations on matrix

#include<iostream>

using namespace std;

void main()

{

int a[2][3]; // store the matrix in 2 dimensional array a

a[0][0]=1; a[0][1]=2; a[0][2]=-1;

a[1][0]=0; a[1][1]=3; a[1][2]=-2;

int b[2][3]; // store the matrix in 2 dimensional array b

b[0][0]=3; b[0][1]=1; b[0][2]=5;

b[1][0]=0; b[1][1]=2; b[1][2]=-1;

int c[2][3]; // store the matrix in 2 dimensional array c

cout<<"The resultant matrix is : " <<endl; //This will print array c

for(int i=0; i<2; i++) // calculate the matrix

for(int j=0; j<3; j++)

cout<<c[i][j]=2*a[i][j]+3*b[i][j]<<" ";

cout<<endl;

return 0;

}