I'm having an issue with this piece of code. When I enter the input(Ex. 150.79 - 789.4) the program does not do anything. It does not even stop running, it continues running. Does anybody know what I'm doing wrong?
    #include <stdio.h>
    int main(void)
    {
    float value1, value2;
    char operator, ch;
    printf("Type in your expression.\n");
    scanf_s("%f %c %f", &value1, &operator, &value2);
When I try to receive input this way, it works.
    //This version works...
    /*
    scanf_s("%f", &value1);
    ch = getchar();
    scanf_s("%c", &operator);
    scanf_s("%f", &value2);
    */
    switch (operator)
    {
    case '+':
    printf ("%.2f\n", value1 + value2);
    break;
    case '-':
        printf("%.2f\n", value1 - value2);
        break;
    case '*':
        printf("%.2f\n", value1 * value2);
        break;
    case '/':
        if (value2 == 0)
            printf("Division by zero.\n");
        else
            printf("%.2f\n", value1 / value2);
        break;
    default:
        printf("Unknown operator.\n");
        break;
    }
    system("pause");
    return 0;
    }
