Hello, everyone!

I am currently working on a project, a Matrix Calculator.

But unlike any matrix calculator there, mine seems to be more complex, or so it seems.

One of my problems is getting the input from the user.

For example, if the user typed MAKE A, he/she will be able to make matrix A;

MAKE B, will do matrix B, and so on;

also if she typed ADDM A B C, the matrix calculator will add matrix A and B and put the answer to matrix C, or something like that.

I've already tried a code for this but it can not be compiled.

What do you think seems to be the problem?

Thanks!Code:/*Matrix Calculator*/ #include <stdio.h> int make_mat(); int disp_mat(); int add_mat(); int cmd_str[20]; int mat_A[20][20], r1, c1; int mat_B[20][20], r2, c2; int mat_C[20][20], r3, c3; int i, j; int main(){ do{ printf("\n>>"); scanf("%s",cmd_str[20]); if(cmd_str[0]=="MAKE") make_mat(); else if(cmd_str[0]=="DISP") disp_mat(); else if(cmd_str[0]=="ADDM") add_mat(); else printf("Invalid Command!"); }while(cmd_str[0] != "EXIT") } /*Make Matrix Function*/ int make_mat(){ if(cmd_str[5] == 'A'){ printf("Enter rows: "); scanf("%d", &r1); printf("Enter columns: "); scanf("%d", &c1); for(i=0;i<r1;i++) for(j=0;j<c1;j++){ printf("A[%d][%d] = ", i, j); scanf("%d",&mat_A[i][j]); } } else if(cmd_str[5] == 'B'){ printf("Enter rows: "); scanf("%d", &r2); printf("Enter columns: "); scanf("%d", &c2); for(i=0;i<r2;i++) for(j=0;j<c2;j++){ printf("B[%d][%d] = ", i, j); scanf("%d",&mat_B[i][j]); } } else if(cmd_str[5] == 'C'){ printf("Enter rows: "); scanf("%d", &r3); printf("Enter columns: "); scanf("%d", &c3); for(i=0;i<r3;i++) for(j=0;j<c3;j++) { printf("C[%d][%d] = ", i, j); scanf("%d",&mat_C[i][j]); } } else printf("Invalid argument!"); } /*Display Matrix Function*/ int disp_mat(){ if(cmd_str[5] == 'A'){ printf("Number of rows: %d \n", r1); printf("Number of columns: %d \n", c1); for(i=0;i<r1;i++){ for(j=0;j<c1;j++) printf("|%d|", mat_A[i][j]); printf("\n"); } } else if(cmd_str[5] == 'B'){ printf("Number of rows: %d \n", r2); printf("Number of columns: %d \n", c2); for(i=0;i<r2;i++){ for(j=0;j<c2;j++) printf("|%d|", mat_B[i][j]); printf("\n"); } } else if(cmd_str[5] == 'C'){ printf("Number of rows: %d \n", r3); printf("Number of columns: %d \n", c3); for(i=0;i<r3;i++){ for(j=0;j<c3;j++) printf("|%d|", mat_C[i][j]); printf("\n"); } } else printf("Invalid Argument!"); /*Add Matrix Function*/ int add_mat(){ if(cmd_str[5] == 'A'){ if(cmd_str[7] == 'A'){ if(cmd_str[9] == 'A'){ for(i=0; i<r1; i++){ for(j=0; j<c1; j++) mat_A[i][j] = mat_A[i][j] + mat_A[i][j]; } } else if(cmd_str[9] == 'B'){ for(i=0; i<r1; i++){ for(j=0; j<c1; j++) mat_B[i][j] = mat_A[i][j] + mat_A[i][j]; } } else if(cmd_str[9] == 'C'){ for(i=0; i<r1; i++){ for(j=0; j<c1; j++) mat_C[i][j] = mat_A[i][j] + mat_A[i][j]; } } else printf("Invalid Argument!"); } else if(cmd_str[7] == 'B'){ if(cmd_str[9] == 'A'){ for(i=0; i<r1; i++){ for(j=0; j<c2; j++) mat_A[i][j] = mat_A[i][j] + mat_B[i][j]; } } else if(cmd_str[9] == 'B'){ for(i=0; i<r1; i++){ for(j=0; j<c2; j++) mat_B[i][j] = mat_A[i][j] + mat_B[i][j]; } } else if(cmd_str[9] == 'C'){ for(i=0; i<r1; i++){ for(j=0; j<c2; j++) mat_C[i][j] = mat_A[i][j] + mat_B[i][j]; } } else printf("Invalid Argument!"); } else if(cmd_str[7] == 'C'){ if(cmd_str[9] == 'A'){ for(i=0; i<r1; i++){ for(j=0; j<c3; j++) mat_A[i][j] = mat_A[i][j] + mat_C[i][j]; } } else if(cmd_str[9] == 'B'){ for(i=0; i<r1; i++){ for(j=0; j<c3; j++) mat_B[i][j] = mat_A[i][j] + mat_C[i][j]; } } else if(cmd_str[9] == 'C'){ for(i=0; i<r1; i++){ for(j=0; j<c3; j++) mat_C[i][j] = mat_A[i][j] + mat_C[i][j]; } } else printf("Invalid Argument!"); } else printf("Invalid Argument!"); } if(cmd_str[5] == 'B'){ if(cmd_str[7] == 'A'){ if(cmd_str[9] == 'A'){ for(i=0; i<r2; i++){ for(j=0; j<c1; j++) mat_A[i][j] = mat_B[i][j] + mat_A[i][j]; } } else if(cmd_str[9] == 'B'){ for(i=0; i<r2; i++){ for(j=0; j<c1; j++) mat_B[i][j] = mat_B[i][j] + mat_A[i][j]; } } else if(cmd_str[9] == 'C'){ for(i=0; i<r2; i++){ for(j=0; j<c1; j++) mat_C[i][j] = mat_B[i][j] + mat_A[i][j]; } } else printf("Invalid Argument!"); } else if(cmd_str[7] == 'B'){ if(cmd_str[9] == 'A'){ for(i=0; i<r2; i++){ for(j=0; j<c2; j++) mat_A[i][j] = mat_B[i][j] + mat_B[i][j]; } } else if(cmd_str[9] == 'B'){ for(i=0; i<r2; i++){ for(j=0; j<c2; j++) mat_B[i][j] = mat_B[i][j] + mat_B[i][j]; } } else if(cmd_str[9] == 'C'){ for(i=0; i<r2; i++){ for(j=0; j<c2; j++) mat_C[i][j] = mat_B[i][j] + mat_B[i][j]; } } else printf("Invalid Argument!"); } else if(cmd_str[7] == 'C'){ if(cmd_str[9] == 'A'){ for(i=0; i<r2; i++){ for(j=0; j<c3; j++) mat_A[i][j] = mat_B[i][j] + mat_C[i][j]; } } else if(cmd_str[9] == 'B'){ for(i=0; i<r2; i++){ for(j=0; j<c3; j++) mat_B[i][j] = mat_B[i][j] + mat_C[i][j]; } } else if(cmd_str[9] == 'C'){ for(i=0; i<r2; i++){ for(j=0; j<c3; j++) mat_C[i][j] = mat_B[i][j] + mat_C[i][j]; } } else printf("Invalid Argument!"); } else printf("Invalid Argument!"); } if(cmd_str[5] == 'C'){ if(cmd_str[7] == 'A'){ if(cmd_str[9] == 'A'){ for(i=0; i<r3; i++){ for(j=0; j<c1; j++) mat_A[i][j] = mat_C[i][j] + mat_A[i][j]; } } else if(cmd_str[9] == 'B'){ for(i=0; i<r3; i++){ for(j=0; j<c1; j++) mat_B[i][j] = mat_C[i][j] + mat_A[i][j]; } } else if(cmd_str[9] == 'C'){ for(i=0; i<r3; i++){ for(j=0; j<c1; j++) mat_C[i][j] = mat_C[i][j] + mat_A[i][j]; } } else printf('Invalid Argument!'); } else if(cmd_str[7] == 'B'){ if(cmd_str[9] == 'A'){ for(i=0; i<r3; i++){ for(j=0; j<c2; j++) mat_A[i][j] = mat_C[i][j] + mat_B[i][j]; } } else if(cmd_str[9] == 'B'){ for(i=0; i<r3; i++){ for(j=0; j<c2; j++) mat_B[i][j] = mat_C[i][j] + mat_B[i][j]; } } else if(cmd_str[9] == 'C'){ for(i=0; i<r3; i++){ for(j=0; j<c2; j++) mat_C[i][j] = mat_C[i][j] + mat_B[i][j]; } } else printf("Invalid Argument!"); } else if(cmd_str[7] == 'C'){ if(cmd_str[9] == 'A'){ for(i=0; i<r3; i++){ for(j=0; j<c3; j++) mat_A[i][j] = mat_C[i][j] + mat_C[i][j]; } } else if(cmd_str[9] == 'B'){ for(i=0; i<r3; i++){ for(j=0; j<c3; j++) mat_B[i][j] = mat_C[i][j] + mat_C[i][j]; } } else if(cmd_str[9] == 'C'){ for(i=0; i<r3; i++){ for(j=0; j<c3; j++) mat_C[i][j] = mat_C[i][j] + mat_C[i][j]; } } else printf("Invalid Argument!"); } else printf("Invalid Argument!"); } else printf("Invalid Argument!"); }