主题:[讨论]C语言新手问个白痴问题,请解读
先说一下,我是新手。我看的C语言入门经典上那本书里
提到枚举的时候说,初始化的时候可以这么写:
enum Weekday {Monday, Tuesday, Wednesday, Thursday,Friday, Saturday, Sunday} today = Monday, tomorrow = today + 1;
但是我在VC++6.0里编译的时候,确有错误,提示是error C2440: 'initializing' : cannot convert from 'int' to 'enum main::Weekday'
Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
我看不太懂,请问该怎么解决这个问题,多谢啦
提到枚举的时候说,初始化的时候可以这么写:
enum Weekday {Monday, Tuesday, Wednesday, Thursday,Friday, Saturday, Sunday} today = Monday, tomorrow = today + 1;
但是我在VC++6.0里编译的时候,确有错误,提示是error C2440: 'initializing' : cannot convert from 'int' to 'enum main::Weekday'
Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
我看不太懂,请问该怎么解决这个问题,多谢啦