/* Program 6.2.2 from M.Sc. C++ Programming Lecture notes  */

/* Author: Rob Miller and William Knottenbelt
   Program last changed: 30th September 2001    */

/* This program allows the user to enter a series of values into two arrays 
   of the same size, and computes their "sum". */ 

#include <iostream>
using namespace std;

const int NO_OF_EMPLOYEES = 6;
typedef int Hours_array[NO_OF_EMPLOYEES];

/* Function to input array values */
void input_hours(Hours_array hrs);

/* Function to add two arrays of type "Hours_array" together */
void add_lists(int first[], int second[], int total[], int length);

/* MAIN PROGRAM */
int main()
{
	Hours_array hours_week_one;
	Hours_array hours_week_two;
	Hours_array hours_both_weeks;
	int count;
	
	cout << "WEEK ONE:\n";
	input_hours(hours_week_one);
	cout << "WEEK TWO:\n";
	input_hours(hours_week_two);
	add_lists(hours_week_one, hours_week_two, hours_both_weeks, NO_OF_EMPLOYEES); 
	
	cout << "TOTALS:\n";
	for (count = 1 ; count <= NO_OF_EMPLOYEES ; count++)
	{
		cout << "Total hours for employee number " << count << ": ";
		cout << hours_both_weeks[count - 1] << "\n";
	}
		
	return 0;
}
/* END OF MAIN PROGRAM */

/* DEFINITION OF FUNCTION "input_hours" */
void input_hours(Hours_array hrs)
{
	int count;
	
	for (count = 1 ; count <= NO_OF_EMPLOYEES ; count++)
	{
		cout << "Enter hours for employee number " << count << ": ";
		cin >> hrs[count - 1];
	}
	cout << "\n";
}
/* END OF FUNCTION DEFINITION */


/* DEFINITION OF FUNCTION "add_lists" */
void add_lists(int first[], int second[], int total[], int length)
{
	int count;
	for (count = 0 ; count < length ; count++)
		total[count] = first[count] + second[count];
}
/* END OF FUNCTION DEFINITION */

