多组输入的题目,这样做为什么我只能输入一组
#include <stdio.h>
int main()
{
int n,a,b,result;
char op;
scanf_s("%d", &n);
while (n--)
{
scanf_s("%d %c %d",&a,&op,&b);
switch (op)
{
case '+': result = a + b; break;
case '-': result = a - b; break;
case '*': result = a * b; break;
case '/': result = a / b; break;
}
printf("%d\n",result);
}
return 0;
}
#include <stdio.h>
int main()
{
int n,a,b,result;
char op;
scanf_s("%d", &n);
while (n--)
{
scanf_s("%d %c %d",&a,&op,&b);
switch (op)
{
case '+': result = a + b; break;
case '-': result = a - b; break;
case '*': result = a * b; break;
case '/': result = a / b; break;
}
printf("%d\n",result);
}
return 0;
}