Using consts and enums in Arrays : enum « Data Type « C++






Using consts and enums in Arrays

  
#include <iostream>
int main()
{
    enum WeekDays { Sun, Mon, Tue,Wed, Thu, Fri, Sat, DaysInWeek };
    int ArrayWeek[DaysInWeek] = { 10, 20, 30, 40, 50, 60, 70 };

   std::cout << "The value at Tuesday is: " << ArrayWeek[Tue];
   return 0;
}
  
    
  








Related examples in the same category

1.Using bit fields.
2.demonstrates enum types
3.demonstrates enums, counts words in phrase
4.demonstrates enumerations