显示布尔类型枚举的值时出现问题。我正在使用的这本书让我对 bool 类型的枚举一无所知。
虽然我可以定义它:
enum class WeekDays : bool { Mon = true, Tues = true, Wed = true, Thurs = true, Fri = true, Sat = false, Sun = false };
我不确定如何在 int main() 函数下显示它,并尝试了很多次无济于事。但是,我可以很好地使用其他枚举并了解它们在做什么,例如:
enum class Suit{Clubs = 1, Diamonds = 2, Hearts = 3, Spades = 4};
int main(array<System::String ^> ^args)
{
Suit suit = Suit::Clubs;
int value = safe_cast<int>(suit);
Console::WriteLine(L"Suit is {0} and the value is {1} ", suit, value);