切换为什么? [英] switch why?
问题描述
#include< stdio.h>
int main()
{
int a = 10;
开关(a)
{
case''1'':
printf(" ONE \ n);
休息;
案例''2'':
printf(" TWO \ n");
break;
defa1ut:
printf(" NONE \ n");
}
返回0;
}
我的期望:------输出为无。
但输出不同为什么?
#include<stdio.h>
int main()
{
int a=10;
switch(a)
{
case ''1'':
printf("ONE\n");
break;
case ''2'':
printf("TWO\n");
break;
defa1ut:
printf("NONE\n");
}
return 0;
}
My expectation :------The output is NONE.
But the output is different why?
推荐答案
vim opined:
vim opined:
#include< stdio.h>
int main()
{a / 10;
开关(a)
{
案例''''':
printf(" ONE \ n");
休息;
案例''2'':
printf(" TWO \ nn);;
休息;
defa1ut:
printf(NONE \ n);
}
返回0;
}
我的期望:--- ---输出是无。
但是输出不同为什么?
#include<stdio.h>
int main()
{
int a=10;
switch(a)
{
case ''1'':
printf("ONE\n");
break;
case ''2'':
printf("TWO\n");
break;
defa1ut:
printf("NONE\n");
}
return 0;
}
My expectation :------The output is NONE.
But the output is different why?
以什么方式不同?
你可能意味着:
案例1:
...
案例2:
>
`int`s与````s的野兽完全不同。
另外,它是'默认'。
-
< http://clc-wiki.net/wiki/Introduction_to_comp.lang.c>
Different in what way?
You probably meant:
case 1:
...
case 2:
`int`s are quite a different beast from `char`s.
Also, it''s `default`.
--
<http://clc-wiki.net/wiki/Introduction_to_comp.lang.c>
vim写道:
#include< stdio.h>
int main()
{
int a = 10;
开关(a)
{
案例''1'':
printf(ONE \ n);
休息;
案例' 2'':
printf(TWO \ n);
休息;
defa1ut:
printf(" NONE \ nn);;
}
返回0;
}
我的期望:------输出是无。
但输出不同为什么?
但输出的原因不同?
#include<stdio.h>
int main()
{
int a=10;
switch(a)
{
case ''1'':
printf("ONE\n");
break;
case ''2'':
printf("TWO\n");
break;
defa1ut:
printf("NONE\n");
}
return 0;
}
My expectation :------The output is NONE.
But the output is different why? But the output is different why?
是否说''语法错误''?
-
==============
不是学生
============ ==
Does it say ''Syntax Error''?
--
==============
Not a pedant
==============
它会正确编译。但答案不是预期的那个
It will compile correctly.But the answer is not the expected one
这篇关于切换为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!