// This program asks for the number of hours worked // by six employees. It stores the values in an array. #include using namespace std; int main() { int count; // Loop counter const int NUM_EMPLOYEES = 6; // Number of employees int hours[NUM_EMPLOYEES]; // Each employee's hours // Input the hours worked. for (count = 0; count < NUM_EMPLOYEES; count++) { cout << "Enter the hours worked by employee " << (count + 1) << ": "; cin >> hours[count]; } // out of bounds cout << hours[NUM_EMPLOYEES]; // Display the contents of the array. cout << "The hours you entered are:"; for (count = 0; count < NUM_EMPLOYEES; count++) cout << " " << hours[count]; cout << "Now trying to access OUT OF BOUNDS, arr[6]: "; cin >> hours[6]; cout << hours[6]; // sometimes program crashes, sometimes just access an // illegal memory location cout << endl; return 0; } /* LAB: Define an array of int or double. Read in values to fill up the array. Iterate through the array and count how many numbers are positive and how many are negative. Print the counts. NOTE: Use at least TWO for loops. */