#include
void main()
{
int a,b,d;
char c;
printf("请输入一种运算符:\n");
scanf("%c",&c);
printf("请输入两个数:\n");
scanf("%d",&a);
scanf("%d",&b);
switch(c)
{
case '+':
d=a+b;break;
case '-':
d=a-b;break;
case '*':
d=a*b;break;
case '/':
d=a/b;break;
default: break;
}
printf("%d",d);
}
用C++编写一个计算器程序.用户输入两个运算数和四则运算符,输出计算结果.
用C++编写一个计算器程序.用户输入两个运算数和四则运算符,输出计算结果.
其他人气:672 ℃时间:2020-02-06 00:49:40
优质解答
我来回答
类似推荐
猜你喜欢
- 1why ___you _____(dress) yourself like that this morning
- 2用4,4,7,8这4个数怎么算才等于24
- 3what are your parents doing.they're watching
- 4汽车每小时行驶48千米,比自行车的3倍多3千米
- 5用0-9这十个数码组成两个五位数,大数减小数的差最小是几
- 6设有定义:int n=0,*p=&n,**q=&p;则一下选项中,正确的赋值语句是()A,P=1B.*q=2 C.q=p D .*p=5
- 7A friend in need is a friend indeed.He laughs best who laugh last.Time will
- 8函数极限的定义证明
- 9首字母填词 please do not talk l— .the kids are sleeping she has long hair and is of medium b___
- 10物理兴趣小组的同学做了这样的实验,在电热水壶中装适量的自来水,用温度计测得水温是20摄氏度 接电压为220v的家庭电路中 通电11.2min水开始沸腾观察发现上标有220v1000w字样 水吸收的热量为多少J 水的质量大约为多少千克