C++ examples for Data Type:enum
Use enumerated constants for the eight compass directions,
#include <iostream> int main() /*from w w w . j av a2 s. c o m*/ { enum Direction { North, Northeast, East, Southeast, South, Southwest, West, Northwest }; // create a variable to hold it Direction heading; // initialize that variable heading = Southeast; std::cout << "Moving " << heading << std::endl; return 0; }