scanf函数可以一次性输入七个数据吗
c语言吧
全部回复
仅看楼主
level 1
低语👦 楼主
#include <stdio.h>
int main()
{int a=0,b=1;
char op,s;
scanf("%c %c %d %c %c %c %d",&s,&s,&a,&s,&s,&s,&b);
scanf("%c %c %c",&s,&op,&s);
printf("%c %c %c",'a',op,'b');
printf("%c",'=');
switch (op)
{
case '+':printf("%d",a+b);break;
case '-':printf("%d",a-b);break;
case '*':printf("%d",a*b);break;
case '/':printf("%f",(float)a/(float)b);break;
case '%':printf("%d",a%b);break;
}
printf("%c",'\n');return 0;}
2019年12月01日 17点12分 1
1