An Enumeration is a user-definable, integral type. An enumeration is defined using the enum keyword. A range of values and a name for these values are also defined the same time.

enum Shape{Line,Rectangle,Ellipse};
1.Example for Enumeration:

#include <iostream> 
using namespace std; 
enum week { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday,Sunday }; 
int main() 
week day; 
day = Friday; 
cout << "Day: " << day+1<<endl; 
return 0; 
Day: 5
Translate »