#include<stdio.h>
main()
{
float a,b,z;
char c;
scanf("%f %c %f",&a,&c,&b);
swich(c)
{
case'+':z=a+b;[break];
case'-':z=a-b;[break];
case'*':z=a*b;[break];
case'/':z=a/b;
}
printf("z=%f\n",z);
}
C:\Users\*\Desktop\Untitled1.c||In function `main':|
C:\Users\*\Desktop\Untitled1.c|8|error: syntax error before '{' token|
C:\Users\m\Desktop\Untitled1.c|10|error: case label not within a switch statement|
C:\Users\Desktop\Untitled1.c|10|error: syntax error before '[' token|
C:\Users\mn\Desktop\Untitled1.c|11|error: case label not within a switch statement|
C:\Users\maun\Desktop\Untitled1.c|11|error: syntax error before '[' token|
C:\Users\Desktop\Untitled1.c|12|error: case label not within a switch statement|
C:\Users\mun\Desktop\Untitled1.c|14|error: syntax error before string constant|
C:\Users\man\Desktop\Untitled1.c|14|error: conflicting types for 'printf'|
C:\Users\mal\Desktop\Untitled1.c|14|note: a parameter list with an ellipsis can't match an empty parameter name list declaration|
C:\Users\m\Desktop\Untitled1.c|14|error: conflicting types for 'printf'|
C:\Users\\Desktop\Untitled1.c|14|note: a parameter list with an ellipsis can't match an empty parameter name list declaration|
C:\Users\un\Desktop\Untitled1.c|14|warning: data definition has no type or storage class|
||=== Build finished: 9 errors, 1 warnings ===|
编程题目(switch语句设计实数四则运算)
答案:3 mip版
解决时间 2021-05-16 07:16
- 提问者网友:醒不来的梦
- 2021-05-15 08:48
最佳答案
- 二级知识专家网友:有你才幸福
- 2021-05-15 09:14
这位朋友说的是,break不需要中括号。不过printf输出语句中的变量前不需要求地址符号的,人家的没错的。
全部回答
- 1楼网友:白衣衬衫净少年
- 2021-05-15 10:51
break是不需要加中括号的!最后一句应该是printf("z=%f\n",&z);
- 2楼网友:柚旅时光机
- 2021-05-15 10:09
首先.swich你写错了...应该是switch
然后...[break];是不用中括号的...改成break;就可以了
我要举报
如以上问答内容为低俗/色情/暴力/不良/侵权的信息,可以点下面链接进行举报,我们会做出相应处理,感谢你的支持!
点此我要举报以上问答信息
推荐资讯