1#include <iostream>
2enum Example :unsigned char // char will work but float will not work because it is not an interger
3{
4 A = 9, B = 56, c = 12//values must be integers
5};//enum is a just a name for a group of numeric values
6int main()
7{
8 Example example = A;
9 // Example example2 = 5;// This gives error because the values must be A , B ,C no other values are accepted in our code however we can break this behaiour in c++
10 if (example == A)//We can use A directly because it is just an unsigned char var but is grouped in Example enum with other values
11 std::cout << "Good" << std::endl;
12 std::cin.get();
13
14}
1enum Foo { a, b, c = 10, d, e = 1, f, g = f + c };
2//a = 0, b = 1, c = 10, d = 11, e = 1, f = 2, g = 12