// Native_Enumerations.cpp : Defines the entry point for the console application. /* ___________________________________________________________ W O R K I N G W I T H E N U M E R A T I O N S Ron Kessler Created 1/23/2017 Native Code Version An enumeration is also a user-defined type but it consists of values known as enumerators that represent integer constants. // This program gets how much money my store took in for a week. Run with CTL-F5 */ #include "stdafx.h" #include #include using namespace std; //---define my enumeration here. By default, Monday will be 0, Tues = 1 and so on. // This makes it easy for us to refer to data using friendly names instead of integers. enum Days { MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY }; int main () { const int NUM_DAYS = 5; // The number of days double sales [NUM_DAYS]; // an array to hold sales for each day double total = 0.0; // Accumulator or running total int index; // Loop counter // Get the sales for each day. for (index = MONDAY; index <= FRIDAY; index++) { cout << "Enter the sales for day " << index << ": "; cin >> sales [index]; } // Calculate the total sales. for (index = MONDAY; index <= FRIDAY; index++) total += sales [index]; // Display the total. cout << "The total sales are $" << setprecision (2) << fixed << total << endl; return 0; }