switch case例程
来源:互联网 发布:产品演示动画制作软件 编辑:程序博客网 时间:2024/05/17 01:04
#include "stdafx.h"main(){int x=1,a=0,b=0;switch(x){case 0:b++;case 1:a++;case 2:a++;b++;}printf("a=%d,b=%d/n",a,b);}
运行结果:
a=2,b=1
又如:
#include "stdafx.h"int main(int argc, char* argv[]){ int x,c,m; float y; scanf("%d",&x); if(x<0) c=-1; else c=x/10; switch(c) { case -1:y=0;break; case 0: y=x;break; case 1:y=10;break; case 2: case 3:y=-0.5*x+20;break; default:y=-2; } if(y!=-2) printf("y=%g/n",y);//输出%F或%E形式中宽度较小的一种。 else printf("error/n"); return 0;}
- switch case例程
- switch..case
- switch case
- switch case
- switch-case
- switch-case
- switch-case
- switch-case
- switch case
- switch case
- Switch case
- switch ....case
- switch...case
- switch...case...
- switch case
- switch-case
- switch...case
- switch case
- 谁能告诉我哪里出错了,JCL
- Spring 的MVC I18N-国际化相关配置出现的问题
- 二维数组与指针
- VC 直方图
- 一个新的开始----
- switch case例程
- 标文通(UOF)
- 枚举进程(1)——遍历通过EPROCESS结构的ActiveProcessLinks链表
- SQL Server 索引基础知识(2)----聚集索引,非聚集索引
- tc3.0中创建工程
- c#连接各种数据库的方法
- Windows脚本编程基础
- 预处理命令与宏定义
- 工具coverity