// Kurt Feiereisel CSC5 Chapter 7, p.444, #1
/*******************************************************************************
*
* Determine Highest and Lowest Values
* _____________________________________________________________________________
* This program accepts ten integers as input. The program will then determine
* and report which integer has the highest value and which integer has the
* lowest value
* _____________________________________________________________________________
* INPUT:
* array[] : Stores the ten integers inputted
*
* OUTPUT:
* highest : Integer with the highest value
* lowest : Integer with the lowest value
*
* ****************************************************************************/
#include <iostream>
using namespace std;
int main()
{
// Initialize Constant
const int SIZE = 10; // Constant: Number of integers for array to
// hold
// Decalre Array
int array[SIZE]; // Array to hold the 10 integers
// Input integers
cout << "Please enter 10 integers." << endl;
for(int index = 0; index < SIZE; index++)
cin >> array[index];
// Initalize Variables
int highest; // OUTPUT: highest integer inputted
int lowest; // OUTPUT: lowest integer inputted
// Determine highest value
highest = array[0];
for (int count = 0; count < SIZE; count++)
{
if (array[count] > highest)
highest = array[count];
}
// Determine lowest value
lowest = array[0];
for (int count = 0; count < SIZE; count++)
{
if(array[count] < lowest)
lowest = array[count];
}
// Display Highest and Lowest Values
cout << highest << " is the highest value." << endl;
cout << lowest << " is the lowest value." << endl;
return 0;
}