I thought of assigning the value of the array to the first element , then compare that to the next number, however dont know I to translate that language into code. Thanks.

#include <iostream> int Function1(double []); void PrintArray(const double [], int); const int MAXSIZE =100; using namespace std; int main() { double array1[100]; int count; count = Function1(array1); cout<<"There were "<<count<<" numbers entered into the array."<<endl; //function call to function that will print the array PrintArray(array1, count); return 0; } //Write the function here to read in numbers into the array. The array is called myarray. //add comments describing what this function does, what is passed to it, what it sends back, etc. int Function1(double myarray[]) { int i =0, number; do { cout << "Enter the number:"; cin >> number; if ( number > 0 && (myarray[i] = MAXSIZE)) { myarray[i] = number; i++; } } while ( (i<100 && number>0) && myarray[i] ); return i; } //Write the new function here along with comments //add comments describing what this function does, what is passed to it, what it sends back, etc. void PrintArray(const double a1[], int size) { for ( int index = 0; index < size; index ++) { cout << "The number number entered is" << a1[index] << endl; } } int BinarySearch(double a[ ], int size, double key) { int high = size -1, low = 0, middle; while( low <=high) { middle = ( low + high)/2; if ( key == a[middle]) { return middle; } else if ( key < a[middle]) { high = middle -1; } else { low = middle + 1; } } return -1; }

This post has been edited by **Martyn.Rae**: 26 March 2010 - 10:39 PM

Reason for edit:: Added code tags