#include<iostream>
using namespace std;


/*
 Pre-conditions: An int array, the size of that
                 array, and a query int are entered
 Post-conditions: returns true if query int is
                  inside input array,
                  otherwise returns false
*/
bool find(int numList[],int size, int query);


int main()
{
 int numList[5], query;

 // Get list of numbers from user
 cout << "Enter 5 numbers for your list: ";
 for(int i=0;i<5;i++) {
   cin >> numList[i];
 }

 // Get query number
 cout << "Enter number to search for: ";
 cin >> query;

 // Report whether query is in list
 if(find(numList,5,query))
   cout << query << " is in your list!\n";
 else
   cout << query << " is not in your list!\n";


 return 0;
}


// Define function to determine whether query is in list
bool find(int numList[],int size, int query)
{
 int i=0;
 while(i<5)
 { // If element number i of list is the same as the
   // query number, return true
   if(numList[i]==query)
     return true;
   i++;
 }

 // If you never returned true while going through the
 // whole list, the query number must not be there
 return false;
}