This code converts an expression A*B-C-D+E to 5*3-2-3+4 using the array elements but it seems to work for only single digits, can anyone assist me here, to make it work fr double digits?
Code:#include<stdio.h> #include<stdlib.h> #define MAXCOLS 80 int main() { const int num_operand =5; const int num_operatr = 4; const int strglen=num_operand+num_operatr; char operand; int i, j; char string[MAXCOLS]; char getexp[strglen+1]; char a[]={'5','3','2','3','4','2','5','4','6','8'}; printf("Enter a command of the sort A+B*C_D*E:\n"); fgets(getexp, sizeof getexp, stdin); for(j=0; getexp[j] != '\0'; j++) { operand=getexp[j]; if(operand >= 'A' && operand <='Z') string[j]=a[operand-(int)('A')]; else string[j]=(char)operand; } string[j] ='\0'; printf("Expression\n"); printf("%s", string); getchar(); return 0; }

