c语言中如何用代码设计一个简单计算器,实瑞两个浮点数的加减乘除,界面如图
展开全部
# include<stdio.h>
void main()
{
double first_number,second_number,value;
char Operator;
printf("please enter the number:\n");
scanf("伍带%lf%c%lf",&first_number,&Operator,&second_number);
switch(Operator)
{
case '+': printf("value=%lf",first_number+second_number );break;
case '腔核芦-': printf("value=%lf",first_number-second_number );break;
case '*': printf("value=%lf",first_number*second_number );break;
case '/': {if(second_number==0) printf("wrong number\n");
else printf("value=%lf"氏汪,first_number/second_number);}
}
}
void main()
{
double first_number,second_number,value;
char Operator;
printf("please enter the number:\n");
scanf("伍带%lf%c%lf",&first_number,&Operator,&second_number);
switch(Operator)
{
case '+': printf("value=%lf",first_number+second_number );break;
case '腔核芦-': printf("value=%lf",first_number-second_number );break;
case '*': printf("value=%lf",first_number*second_number );break;
case '/': {if(second_number==0) printf("wrong number\n");
else printf("value=%lf"氏汪,first_number/second_number);}
}
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询