I practice a simple example to input operator in C: The code as here:
#include <stdio.h>
int main() {
    int a,b;
    char opera;
    printf("input 2 integer number ");
    scanf("%d %d",&a,&b);
    printf("\n input the operator: ");
    scanf("%c", &opera);
    switch (opera)
    {
    case '+':
        printf("result is %d \n", a+b);
        break; 
    default:
        break;
    }
}
Problem: Terminal will pass the input operator
input 2 integer number
4 5
input the operator:
PS D:\Quang\3. Study\C\Bai 2\.vscode>
But if I input operate first, it work:
#include <stdio.h>
int main() {
    int a,b;
    char opera;
    printf("\n input the operator: ");
    scanf("%c", &opera);
    printf("input 2 integer number");
    scanf("%d %d",&a,&b);
    switch (opera)
    {
    case '+':
        printf("result is %d \n",a+b);
        break; 
    default:
        break;
    }
}
Result:
input the operator: +
input 2 integer number 4 5
result is 9
Anyone has the same issue with VS Code?
 
     
     
     
    