Question: CONVERT THE FOLLOWING CODE INTO C LANGUAGE I NEED A PROPER OUTPUT FOR THE CONVERTED C LANGUAGE CODE. ONLYYYY RIGHTTT ANSWERSSS WILLL BEEE APPRECIATEDDD -------------------------------------------------------------------------------------------------------------------------------------
CONVERT THE FOLLOWING CODE INTO C LANGUAGE I NEED A PROPER OUTPUT FOR THE CONVERTED C LANGUAGE CODE.
ONLYYYY RIGHTTT ANSWERSSS WILLL BEEE APPRECIATEDDD
-------------------------------------------------------------------------------------------------------------------------------------
CODE:
---------
#include
using namespace std;
int matrix1[3][3]={3,7,3,9,2,0,0,2,1}; int matrix2[3][3]={6,5,5,1,7,9,6,6,8}; int result[3][3]={};
void* matrixadd(void* argv){
for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { result[i][j]=(matrix1[i][j])+(matrix2[i][j]); } }
for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { cout< pthread_exit(NULL); } void* matrixsub(void* argv){ for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { result[i][j]=(matrix1[i][j])-(matrix2[i][j]); } } for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { cout< pthread_exit(NULL); } void* matrixmul(void* argv){ for(int i = 0; i < 3; ++i) for(int j = 0; j < 3; ++j) for( int k = 0; k < 3; ++k) { result[i][j] += matrix1[i][k] * matrix2[k][j]; } for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { cout< pthread_exit(NULL); } int main(int argc, char** args) { cout<<"Start "; pthread_t* tid = new pthread_t[4]; cout<<" The result of matrix addition is "; pthread_create(&tid[0], NULL, matrixadd, NULL); pthread_join(tid[0], NULL); cout<<" The result of matrix subtraction is "; pthread_create(&tid[1], NULL, matrixsub, NULL); pthread_join(tid[1], NULL); cout<<" The result of matrix multiplication is "; pthread_create(&tid[2], NULL, matrixmul, NULL); pthread_join(tid[2], NULL); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
