//Nathan Dominguez CSC5 Chapter 7, P. 444, #1
//
/*******************************************************************************
*
* Display the Largest and Smallest Values
* _____________________________________________________________________________
* This program will allow the user to enter 10 values into an
* array. The program should then display the largest and smallest
* values stored into the array.
* _____________________________________________________________________________
* INPUT
* value :The values entered in the array
*
* OUTPUT
* large :The largest value in the array
* small :The smallest value in the array
*
******************************************************************************/
#include <iostream>
using namespace std;
int main()
{
const int aSize = 10; // The size of the array
int value[aSize]; // INPUT - The values entered in the array
int large; // OUTPUT - The largest value in the array
int small; // OUTPUT - The smallest value in the array
int count; // LOOP - counter
//
// Input the 10 values
for(count = 0; count < aSize; count++)
{
cout << "Enter the a value for value "<< (count + 1);
cout << ": " << endl;
cin >> value[count];
}
//
// Aquires Largest Value of Array
large = value[0];
for(count = 0; count < aSize; count++)
{
if (value[count] > large)
large = value[count];
}
//
// Aquires Smallest Value of Array
small = value[0];
for(count = 0; count < aSize; count++)
{
if (value[count] < small)
small = value[count];
}
//
// Display Output largest and smallest value
cout << "The largest value in the array is " << large << endl;
cout << "The smallest value in the array is " << small;
return 0;
}