#include<iostream>
using namespace std;


void printList(int list[], int size);
// Preconditions: inputs are array of integers and size
//                of array
// Postconditions: Each element of array is printed to
//                 screen


int min(int list[], int size);
// Preconditions: inputs are array of integers and size
//                of array
// Postconditions: Each element of array is printed to
//                 screen


int main()
{
 // Initialize list of numbers
 int numList[8]={5,1,10,12,4,-5,0,8};


 // Print out elements of list
 cout << "Elements of list are ";
 printList(numList,8);
 cout << endl;


 // Compute and report minimum element of list
 int minNumber = min(numList, 8);

 cout << "Minimum number of list is "
      << minNumber << endl;
}


// Print out elements of list
void printList(int list[], int size)
{
 for(int i=0;i<size;i++)
   cout << list[i] << " ";
 return;
}


// Find minimum value in list
int min(int list[], int size)
{
 // Initialize min value with a number
 // that is very big
 int minValue=10000;

 // Loop through array
 for(int i=0;i<size;i++)
 {
   // If element i is smaller than current
   // guess of "minValue", place element i
   // as minValue
   if(minValue>list[i])
     minValue=list[i];
 }

 return minValue;
}