要输出两个异号数字,可以运行,但是系统不给过

img

img

img

供参考:

#include<stdio.h>
int main()
{
     int x1, x2, n, flg;
     do{
         flg = 0;
         printf("Input x1, x2:\n");
         n = scanf("%d,%d", &x1, &x2);
         switch (n){
                 case 0:
                        while(getchar()!='\n');
                        flg = 1;
                        break;
                 case 1:
                        while(getchar()!='\n');
                        flg = 1;
                        break;
                 default:
                        if (x1 * x2 >= 0)
                             flg = 1;
                        else
                             flg = 0;
                        break;
         }
     }while (flg == 1);
     printf("x1=%d,x2=%d\n",x1,x2);

     return 0;
}