New with CS, and new with C language. Please help with the program needs to support all +, -, *, /, % functions and return the user input equation's result. The program should be continuously accepting new input until the user enters a blank line. and shouldn't print any output except for the equation's result.
e.g. input and output:
8 + 2 (enter) - user input
10 - output
8 - 2 (enter) - user input
6 - output
(enter) - user input(program terminates)
the hint was provided are use gets() & sscanf() to take input from user.
 #include <stdio.h>
    
    int main()
    {
            char equation[10];
            int x, y, result;
            char eqsign[2];
            int switchnum;
            
            gets(equation);
            sscanf(equation, "%d %s %d", &x, eqsign, &y);
            
            if (eqsign == '+')
                switchnum = 0;
            else if (eqsign == '-')
                switchnum = 1;
            else if (eqsign == '*')
                switchnum = 2;
            else if (eqsign == '/')
                switchnum = 3;
            else if (eqsign == '%')
                switchnum = 4;
            
            while(equation != "\0")
            {
                switch(switchnum)
                    case '0':
                        result = x + y;
                        printf("%d", result);
                        break;
                   case '1':
                        result = x - y;
                        printf("%d", result);
                        break;
                   case '2':
                        result = x * y;
                        printf("%d", result);
                        break;
                   case '3':
                        result = x / y;
                        printf("%d", result);
                        break;
                   case '4':
                        result = x % y;
                        printf("%d", result);
                        break;    
            }
            return 0;
}
The code I have now is not running correctly, please provide any suggestions with C! Having a lot of problems on how to compare the operator form input. Any help would be appreciated!
 
     
    