#include <iostream> // We can define an enum to represent colors. // In this case, keRed = 0, keBlue = 1, keYellow = 2. enum EColor {keRed, keBlue, keYellow}; int main() { using namespace std; // Create an instance of the type and assign it the value keRed. EColor eMyColor = keRed; cout << "Color enum value = " << eMyColor << endl; // Output the constant enum values. cout << "keRed = " << keRed << endl; cout << "keBlue = " << keBlue << endl; cout << "keYellow = " << keYellow << endl; // Keep the console window open. cin.get(); return 0; }
© 20072025 XoaX.net LLC. All rights reserved.