问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

用C语言编写一个计算器程序!要用switch函数,case1 case2那种! 要求:可

发布网友 发布时间:2022-05-07 19:42

我来回答

2个回答

热心网友 时间:2023-11-08 13:49

38
#include <<a href="https://www.baidu.com/s?wd=stdio.h&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dWPWnkm1f1nH-bryDknyRk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHRYPWT3Pjbv" target="_blank" class="-highlight">stdio.h</a>>
#include<<a href="https://www.baidu.com/s?wd=math.h&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dWPWnkm1f1nH-bryDknyRk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHRYPWT3Pjbv" target="_blank" class="-highlight">math.h</a>>

void main()
{
char c;
float a,b,r;
while(1)
{
printf("输入运算式:");
scanf("%f%c%f",&a,&c,&b);
switch(c)
{
case '+':
r = a+b;
break;
case '-':
r = a-b;
break;
case '*':
r = a*b;
break;
case '/':
r = a/b;
break;
case '^':
r = pow(a,b);
break;
case '#':
r = sqrt(a);
break;
default:
printf("不支持此运算!");
continue;
}
printf("%.0f%c%.0f=%.2f\n",a,c,b,r);
}
}

热心网友 时间:2023-11-08 13:49

floatdata1,data2;charop;这两句放在printf 前面,c程序定义变量在前面还少了个}

热心网友 时间:2023-11-08 13:49

38
#include <<a href="https://www.baidu.com/s?wd=stdio.h&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dWPWnkm1f1nH-bryDknyRk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHRYPWT3Pjbv" target="_blank" class="-highlight">stdio.h</a>>
#include<<a href="https://www.baidu.com/s?wd=math.h&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dWPWnkm1f1nH-bryDknyRk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHRYPWT3Pjbv" target="_blank" class="-highlight">math.h</a>>

void main()
{
char c;
float a,b,r;
while(1)
{
printf("输入运算式:");
scanf("%f%c%f",&a,&c,&b);
switch(c)
{
case '+':
r = a+b;
break;
case '-':
r = a-b;
break;
case '*':
r = a*b;
break;
case '/':
r = a/b;
break;
case '^':
r = pow(a,b);
break;
case '#':
r = sqrt(a);
break;
default:
printf("不支持此运算!");
continue;
}
printf("%.0f%c%.0f=%.2f\n",a,c,b,r);
}
}

热心网友 时间:2023-11-08 13:49

floatdata1,data2;charop;这两句放在printf 前面,c程序定义变量在前面还少了个}

热心网友 时间:2023-11-08 13:49

38
#include <<a href="https://www.baidu.com/s?wd=stdio.h&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dWPWnkm1f1nH-bryDknyRk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHRYPWT3Pjbv" target="_blank" class="-highlight">stdio.h</a>>
#include<<a href="https://www.baidu.com/s?wd=math.h&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dWPWnkm1f1nH-bryDknyRk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHRYPWT3Pjbv" target="_blank" class="-highlight">math.h</a>>

void main()
{
char c;
float a,b,r;
while(1)
{
printf("输入运算式:");
scanf("%f%c%f",&a,&c,&b);
switch(c)
{
case '+':
r = a+b;
break;
case '-':
r = a-b;
break;
case '*':
r = a*b;
break;
case '/':
r = a/b;
break;
case '^':
r = pow(a,b);
break;
case '#':
r = sqrt(a);
break;
default:
printf("不支持此运算!");
continue;
}
printf("%.0f%c%.0f=%.2f\n",a,c,b,r);
}
}

热心网友 时间:2023-11-08 13:49

floatdata1,data2;charop;这两句放在printf 前面,c程序定义变量在前面还少了个}

热心网友 时间:2023-11-08 13:49

38
#include <<a href="https://www.baidu.com/s?wd=stdio.h&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dWPWnkm1f1nH-bryDknyRk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHRYPWT3Pjbv" target="_blank" class="-highlight">stdio.h</a>>
#include<<a href="https://www.baidu.com/s?wd=math.h&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dWPWnkm1f1nH-bryDknyRk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHRYPWT3Pjbv" target="_blank" class="-highlight">math.h</a>>

void main()
{
char c;
float a,b,r;
while(1)
{
printf("输入运算式:");
scanf("%f%c%f",&a,&c,&b);
switch(c)
{
case '+':
r = a+b;
break;
case '-':
r = a-b;
break;
case '*':
r = a*b;
break;
case '/':
r = a/b;
break;
case '^':
r = pow(a,b);
break;
case '#':
r = sqrt(a);
break;
default:
printf("不支持此运算!");
continue;
}
printf("%.0f%c%.0f=%.2f\n",a,c,b,r);
}
}

热心网友 时间:2023-11-08 13:49

floatdata1,data2;charop;这两句放在printf 前面,c程序定义变量在前面还少了个}

热心网友 时间:2023-11-08 13:49

38
#include <<a href="https://www.baidu.com/s?wd=stdio.h&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dWPWnkm1f1nH-bryDknyRk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHRYPWT3Pjbv" target="_blank" class="-highlight">stdio.h</a>>
#include<<a href="https://www.baidu.com/s?wd=math.h&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dWPWnkm1f1nH-bryDknyRk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHRYPWT3Pjbv" target="_blank" class="-highlight">math.h</a>>

void main()
{
char c;
float a,b,r;
while(1)
{
printf("输入运算式:");
scanf("%f%c%f",&a,&c,&b);
switch(c)
{
case '+':
r = a+b;
break;
case '-':
r = a-b;
break;
case '*':
r = a*b;
break;
case '/':
r = a/b;
break;
case '^':
r = pow(a,b);
break;
case '#':
r = sqrt(a);
break;
default:
printf("不支持此运算!");
continue;
}
printf("%.0f%c%.0f=%.2f\n",a,c,b,r);
}
}

热心网友 时间:2023-11-08 13:49

floatdata1,data2;charop;这两句放在printf 前面,c程序定义变量在前面还少了个}

热心网友 时间:2023-11-08 13:49

38
#include <<a href="https://www.baidu.com/s?wd=stdio.h&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dWPWnkm1f1nH-bryDknyRk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHRYPWT3Pjbv" target="_blank" class="-highlight">stdio.h</a>>
#include<<a href="https://www.baidu.com/s?wd=math.h&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dWPWnkm1f1nH-bryDknyRk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHRYPWT3Pjbv" target="_blank" class="-highlight">math.h</a>>

void main()
{
char c;
float a,b,r;
while(1)
{
printf("输入运算式:");
scanf("%f%c%f",&a,&c,&b);
switch(c)
{
case '+':
r = a+b;
break;
case '-':
r = a-b;
break;
case '*':
r = a*b;
break;
case '/':
r = a/b;
break;
case '^':
r = pow(a,b);
break;
case '#':
r = sqrt(a);
break;
default:
printf("不支持此运算!");
continue;
}
printf("%.0f%c%.0f=%.2f\n",a,c,b,r);
}
}

热心网友 时间:2023-11-08 13:49

floatdata1,data2;charop;这两句放在printf 前面,c程序定义变量在前面还少了个}

热心网友 时间:2023-11-08 13:49

38
#include <<a href="https://www.baidu.com/s?wd=stdio.h&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dWPWnkm1f1nH-bryDknyRk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHRYPWT3Pjbv" target="_blank" class="-highlight">stdio.h</a>>
#include<<a href="https://www.baidu.com/s?wd=math.h&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dWPWnkm1f1nH-bryDknyRk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHRYPWT3Pjbv" target="_blank" class="-highlight">math.h</a>>

void main()
{
char c;
float a,b,r;
while(1)
{
printf("输入运算式:");
scanf("%f%c%f",&a,&c,&b);
switch(c)
{
case '+':
r = a+b;
break;
case '-':
r = a-b;
break;
case '*':
r = a*b;
break;
case '/':
r = a/b;
break;
case '^':
r = pow(a,b);
break;
case '#':
r = sqrt(a);
break;
default:
printf("不支持此运算!");
continue;
}
printf("%.0f%c%.0f=%.2f\n",a,c,b,r);
}
}

热心网友 时间:2023-11-08 13:49

floatdata1,data2;charop;这两句放在printf 前面,c程序定义变量在前面还少了个}

热心网友 时间:2023-11-08 13:49

38
#include <<a href="https://www.baidu.com/s?wd=stdio.h&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dWPWnkm1f1nH-bryDknyRk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHRYPWT3Pjbv" target="_blank" class="-highlight">stdio.h</a>>
#include<<a href="https://www.baidu.com/s?wd=math.h&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dWPWnkm1f1nH-bryDknyRk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHRYPWT3Pjbv" target="_blank" class="-highlight">math.h</a>>

void main()
{
char c;
float a,b,r;
while(1)
{
printf("输入运算式:");
scanf("%f%c%f",&a,&c,&b);
switch(c)
{
case '+':
r = a+b;
break;
case '-':
r = a-b;
break;
case '*':
r = a*b;
break;
case '/':
r = a/b;
break;
case '^':
r = pow(a,b);
break;
case '#':
r = sqrt(a);
break;
default:
printf("不支持此运算!");
continue;
}
printf("%.0f%c%.0f=%.2f\n",a,c,b,r);
}
}

热心网友 时间:2023-11-08 13:49

floatdata1,data2;charop;这两句放在printf 前面,c程序定义变量在前面还少了个}

热心网友 时间:2023-11-08 13:49

38
#include <<a href="https://www.baidu.com/s?wd=stdio.h&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dWPWnkm1f1nH-bryDknyRk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHRYPWT3Pjbv" target="_blank" class="-highlight">stdio.h</a>>
#include<<a href="https://www.baidu.com/s?wd=math.h&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dWPWnkm1f1nH-bryDknyRk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHRYPWT3Pjbv" target="_blank" class="-highlight">math.h</a>>

void main()
{
char c;
float a,b,r;
while(1)
{
printf("输入运算式:");
scanf("%f%c%f",&a,&c,&b);
switch(c)
{
case '+':
r = a+b;
break;
case '-':
r = a-b;
break;
case '*':
r = a*b;
break;
case '/':
r = a/b;
break;
case '^':
r = pow(a,b);
break;
case '#':
r = sqrt(a);
break;
default:
printf("不支持此运算!");
continue;
}
printf("%.0f%c%.0f=%.2f\n",a,c,b,r);
}
}

热心网友 时间:2023-11-08 13:49

floatdata1,data2;charop;这两句放在printf 前面,c程序定义变量在前面还少了个}
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
水笔在手上画画会不会被衣服搽掉下来 老人每天大便次数很多量不多也不稀,每天还会拉三四次水应经三个月了... 从大连飞机场怎么去大连经济开发区5彩城K区的大连金港大酒店 除了打 ... 请问从大连周水子国际机场到经济技术开发区怎么走最省钱? 中国古代名刀总录中国古代十大名刀 怎样把qq安装到iphone里面 苏科大什么梗 苏科大叫什么名字 lol苏科大是苏州科技大学的吗 lol苏州科技大学为什么这么厉害 优尔精医用降温贴是不是保健品? 买股票是怎么赚钱的呢(需要专家级的指导) VB做计算器的sqrt编程具体是怎样的呢 用单片机C语言编程做个计算器,求详细代码,一定要可用的,发到youlingjujishou@163.com谢谢。 怎样用单片机实验板上的矩阵键盘和显示器编写一个简单的计算器,要求能一位数和两位数的加减乘除? 系统时间计算器哪有? 卡西欧计算器亮彩系列有什么特点? 各位,买腾讯微保有什么必要么? 腾讯微保是什么?怎么样?? 为什么我的微信支付不了了,上面显示微信支付已超过十万。是什么意思? 腾讯微保可靠吗?- 问一问 捭阖 是什么意思啊 请教鬼谷子第一章“捭阖第一”中捭阖的含义? 《鬼谷子·捭阖》到底是贵得其指还是实得其之 ,谈谈你对纵横捭阖术的理解,对你有什么启发,不少于200字? 谁理解捭阖的意思? 请教鬼谷子第一章“捭阖第一”中捭阖的含义 捭阖篇中怎样讲解了能使计谋成功的方法? 运用捭阖之术有什么要求与法则? 什么是运用“捭阖”之术的基本法则,是游说他人的谋略? 什么是捭阖术?现代人如何运用它发财? 广州2011成人高考可以带计算器吗 金立gn7000w的卡槽2只可以用2g么 金立GN100的基本功能 金立GN305和步步高vivoS7哪一个好,求推荐啊··· U盘带进来的毒 金立最高端手机是哪一款 晏怎么读姓氏? vivo s7 oppo u701 金立 gn305哪个好 晏这个字读什么 金立GN305和步步高VIVOs6哪个好呢?我感觉配置都差不多啊?~~请大虾指点 晏做姓怎么读 宴在姓里怎么读 晏字在姓名里怎么读 晏怎么读。 晏是姓氏吗 晏子之父的名字的汉语拼音 一个姓氏一句话,用晏怎么说 不认识这个字的念yan第四声 有 没有中介 的租房合同范本吗?(具有法律效力的) 租房跟中介签合同注意什么 初2英语语法短语句子,关于sth和sb的哦