请问这个程序哪里出问题了?为什么运行显示出错了
#include<stdio.h>intmain(){doublea,b;charoperator;printf("输入表达式为:");scanf("%lf%c%lf",...
#include<stdio.h>
int main()
{
double a,b;
char operator;
printf("输入表达式为:");
scanf("%lf%c%lf",&a,&operator,&b);
switch(operator){
case '+': printf("=%.2lf",a+b); break;
case '-': printf("=%.2lf",a-b); break;
case '*': printf("=%.2lf",a*b); break;
case '/': printf("=%.2lf",a/b); break;
default: printf("未知的字符类型\n"); break;
}
return 0;
} 展开
int main()
{
double a,b;
char operator;
printf("输入表达式为:");
scanf("%lf%c%lf",&a,&operator,&b);
switch(operator){
case '+': printf("=%.2lf",a+b); break;
case '-': printf("=%.2lf",a-b); break;
case '*': printf("=%.2lf",a*b); break;
case '/': printf("=%.2lf",a/b); break;
default: printf("未知的字符类型\n"); break;
}
return 0;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询