初用枚举型
来源:互联网 发布:知乎日报与知乎 编辑:程序博客网 时间:2024/04/30 13:15
#include <iostream.h>
enum WEEKDAY
{
sun,mon,tue,wed,thu,fri,sat
};
WEEKDAY nextDayof(WEEKDAY today)
{
if(today <7){
if (today==sat)
{
return sun;
}
return static_cast <WEEKDAY>(today+1);
}
else{
cout<<"input error" <<endl;
return static_cast <WEEKDAY>(-1);
}
}
void main()
{
int today, nextday;
cout <<"input today:";
cin>>today;
nextday=nextDayof(static_cast <WEEKDAY>(today));
switch(nextday){
case 0:
cout<<"the next day is :" <<"sun" <<endl;
break;
case 1:
cout <<"the next day is :" <<"mon" <<endl;
break;
case 2:
cout <<"the next day is :" <<"tue" <<endl;
break;
case 3:
cout <<"the next day is :" <<"wed" <<endl;
break;
case 4:
cout <<"the next day is :" <<"thu" <<endl;
break;
case 5:
cout <<"the next day is :" <<"fri" <<endl;
break;
case 6:
cout <<"the next day is :" <<"sat" <<endl;
break;
}
}
- 初用枚举型
- 枚举型
- 枚举型
- Java枚举中嵌套枚举用例
- java枚举初解析
- 枚举型举例
- 泛型与枚举
- 枚举,泛型详解
- 枚举,泛型详解
- 枚举 与泛型
- [JAVA] 枚举型使用方法
- 008.Enum 枚举型
- 枚举与泛型
- 泛型和枚举
- 枚举和泛型
- 008.Enum 枚举型
- 共用体,枚举型
- 枚举型数据用法
- 解决页面刷新后跳回顶部的问题
- 乐乐音响
- 江南之行
- Windows Mobile 7平台09年发布 可能采用微软硬件
- 光盘的文件复用
- 初用枚举型
- 关注IT,关注外包
- 世界500强牛企英语面试精彩问答
- Hibernate查询错误
- servlet的生命周期
- 将 IBM Rational 变更管理与 Subversion 结合起来(转)
- 四月初
- Linux起步:常用命令
- 跳啊跳的,就习惯了……