enums c++ code example
Example 1: enum c++
enum Colors
{
BLACK,
GREEN,
BLUE,
RED
};
Example 2: enum c++
enum season { spring, summer, autumn, winter };
Example 3: enum c++
enum Foo { a, b, c = 10, d, e = 1, f, g = f + c };
Example 4: enum in c++
#include <iostream>
enum Example :unsigned char
{
A = 9, B = 56, c = 12
};
int main()
{
Example example = A;
if (example == A)
std::cout << "Good" << std::endl;
std::cin.get();
}
Example 5: enum c++
enum season
{ spring = 0,
summer = 4,
autumn = 8,
winter = 12
};
Example 6: enum c++
enum names {blah1, Blah2 , blah3};