Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Here is what I have so far #include #include #define _CRT_NO_WARNINGS_ #define _USE_MATH_DEFINES void readMatrix(int array[10][10], int rows, int columns); void printfMatrix(int array[10][10], int rows,
Here is what I have so far
#include
#include
#define _CRT_NO_WARNINGS_
#define _USE_MATH_DEFINES
void readMatrix(int array[10][10], int rows, int columns);
void printfMatrix(int array[10][10], int rows, int columns);
void addMatrix(int arrayA[10][10], int arrayB[10][10]);
void subtractMatrix(int arrayA[10][10], int arrayB[10][10]);
void multiplyMatrix(int arrayA[10][10], int arrayB[10][10]);
void ScalarMatrix(int arrayA[10][10], int scalar);
int main(void)
{
int arrayA[10][10];
int rowsA, columnsA;
int arrayB[10][10];
int rowsB,columnsB;
printf("enter elements of matrix A ");
printf(" how many rows and columns?: ");
scanf("%d%d", &rowsA, &columnsA);
readMatrix(arrayA, rowsA, columnsA);
printf(" Matrix A ********************** ");
printfMatrix(arrayA, rowsA, columnsA);
printf("enter elements of matrix B ");
printf(" how many rows and columns?: ");
scanf("%d%d", &rowsB, &columnsB);
readMatrix(arrayB, rowsB, columnsB);
printf(" Matrix B ********************** ");
printfMatrix(arrayB, rowsB, columnsB);
return 0;
}
//user defined function
void readMatrix(int array[10][10], int rows, int columns){
int i, j;
for (i = 0; i
printf("%d entries for row %d: ", columns, i + 1);
for (j = 0; j
scanf("%d", &array[i][j]);
}
}
return;
}
void printfMatrix(int array[10][10], int rows, int columns){
int i, j;
for (i = 0; i
MATRIX CALCULATOR Design a Matrix Calculator in C that performs matrix addition, subtraction, scalar multiplication and matrix multiplication using User Defined Functions. The user should be able to choose the operation they want to perform from a menu that loops. The User Defined Functions are given with each menu operation below. Matricies can be of any size, but your program needs to test for operation size errors. If the operation cannot be done, print an error message Menu idea: MATRIX CALCULATOR Enter an operation: Associated User Defined Function 1- Add two matricies 2-Subtract two matricies 3 - Scalar Multiply one matrix 4- Multiple two matricies void matrixAddSub (int arroy1[10][10J, int array2[10](10L etc) uses same User Defined Function above void matrixScalarMultiplyfint array1[10)[101, etc) void matrixMultiply (int arroy1 [10|[10], int array2[101[10]. et (message if 1 to 4 not entered You must also include User Defined functions for a readMatrix and a printMatrix void readMatrix(int array1[10][10], int rows, int columns) void printMatrixfint array1[10]/10], int rows, int columns) Test Cases I 3-2] [5 2-11 16 5-3 42 3 +3 1 273s -1 5 4][43-2] L3 8 2] 4 23 -2 4 Error Message: Size Error -cannot subtract. (User should not have to enter 1 21 3 6 -9 12 011.17 10 a6 9 12 Error Message: Size Error -cannot multiply. 8 11 14 14610][1 4 61 275 31.12 751= 70 60 102 9 011 31 o for (j = 0; j
printf("\t%d", array[i][j]);
}//END OF J
printf(" ");
}// END OF FOR
}// END OF PRINT MATRIX
void addMatrix(int arrayA[10][10], int arrayB[10][10]){
int result = 0;
result=(arrayA[10][10] + arrayB[10][10]);
return;
}
void subtractMatrix(int arrayA[10][10], int arrayB[10][10]){
int result = 0;
result = (arrayA[10][10] - arrayB[10][10]);
return;
}
void multiplyMatrix(int arrayA[10][10], int arrayB[10][10]){
int result = 0;
result = (arrayA[10][10] * arrayB[10][10]);
return;
}
void ScalarMatrix(int arrayA[10][10],int scalar){
int result = 0;
int scalar = 0;
result = (arrayA[10][10] * scalar);
return;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started