SWITCH 语句注意事项
1 error: switch quantity not an integer
分析:switch(xxx) xxx只能是整型表达式 不能用string类型 可以用char int 不能用double string ....
2 error:jump to case label [-fpermissive]
note : crosses initilization of 'int c'
分析: 提示:跳过 int c 的初始化 c作用域在switch{}中,如果掉过case 1 那么c就没有被定义
解决办法:1 case 1:后面2句用{ } 使其作用于只在 {}内部
2 去掉default
3 c定义放在switch外部
tip:switch(a>b)是可以的 a>b 非0即1 是int类型