// Saliha Babar                  CS1A                  Chapter 7, Page 444, #1
//
/*****************************************************************************
 * DETERMINE LARGEST AND SMALLEST VALUES
 * ___________________________________________________________________________
 * This program accepts 10 integers and determines the largest and the smallest
 * value in that list.
 * 
 * There is no specific formula for this program
 * ___________________________________________________________________________
 * INPUT 
 *   numbers          : user input for each integers
 * 
 * OUTPUT
 *   smallest         : smallest integer in the list
 *   largest          : largest integer in the list
 ******************************************************************************/
#include <iostream>
using namespace std;

int main() {
	const int maxNumbers = 10;    // INPUT - maximum integers for input
	int numbers[maxNumbers];      // INPUT - user input for each integers 
	int largest;                  // OUTPUT - largest integer in the list
	int smallest;                 // OUTPUT - smallest integer in the list
	
	// Get the user Input
	for ( int count = 0; count < maxNumbers ; count ++)
	{
		cout << "Enter an integer #" << (count + 1 ) << " :" ;
		cin >> numbers[count];
		cout << endl;
	}
	
	// Determine the largest and smallest value
	largest = numbers[0];
	smallest = numbers[0];
	
	for ( int count = 1 ; count < maxNumbers ; count ++)
	{
		if (numbers[count] < smallest )
		smallest = numbers[count];
		
		if ( numbers[count] > largest )
		largest = numbers[count];
	}
	
	cout << "The smallest integer is " << smallest << endl;
	cout << "The largest integer is "  << largest << endl;
	
	return 0;
}