枚举类型
来源:互联网 发布:arraypush php 编辑:程序博客网 时间:2024/04/30 19:31
枚举类型Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:32768KBTotal submit users: 133, Accepted users: 132Problem 10494 : No special judgementProblem description 已知枚举类型定义如下:
Output 对每行数据,输出与该整数对应的枚举常量的英文名称,换行。
Sample Input
enum color{red, yellow, blue, green, white, black};
从键盘输入一整数,显示与该整数对应的枚举常量的英文名称。
Output 对每行数据,输出与该整数对应的枚举常量的英文名称,换行。
Sample Input
01Sample Output
redyellow
代码:
#include <iostream>using namespace std;int main(){enum colors{red,yellow,blue,green,white,black}; int i,j; colors color; while(cin>>i) { for(j=0;j<=i;j++) { switch(i) { case 0:color=colors(j);break; case 1:color=colors(j);break; case 2:color=colors(j);break; case 3:color=colors(j);break; case 4:color=colors(j);break; case 5:color=colors(j);break; } } switch(color){case red: cout<<"red"<<endl;break;case yellow:cout<<"yellow"<<endl;break;case blue:cout<<"blue"<<endl;break;case green:cout<<"green"<<endl;break;case white:cout<<"white"<<endl;break;case black:cout<<"black"<<endl;break;} } return 0;}
- 枚举类型
- 枚举类型
- 枚举类型
- 枚举类型
- 枚举类型
- 枚举类型
- 枚举类型
- 枚举类型
- 枚举类型
- 枚举类型
- 枚举类型
- 枚举类型
- 枚举类型
- 枚举类型
- 枚举类型
- 枚举类型
- 枚举类型
- 枚举类型
- 应聘linux_ARM嵌入式简历
- 嵌入式面试题的一些答案
- 使用ListView进行滑动分页
- PaaS乱局:Container的新机遇
- 利用logminer,恢复delete误删除操作的数据
- 枚举类型
- Codeforces #199前三题
- 数学中各种空间 的那点小事
- Ubuntu手动安装Chrome&FirFox的flash插件tar.gz
- ListView滑动分页,并加载部分数据
- 转载:PostgreSQL学习手册(八) 性能提升技巧
- log4j初体验
- linux 网络质量检测 网络故障
- 程序实现ContentProvider