I have most of my code written (3 recursive functions, one to fill an array with 50 randomly generated numbers between 1 and 500, one to print out all 50 numbers, and a binary search function to show the position of any chosen number. I had it working until I changed the FillRand function and Print function to recursive instead of loops, and the program does not do anything when ran anymore. It's really something simple I'm sure, I just can't find it.
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
void FillRand(int randArray[], int); // random number function
void Print(int randArray[], int); //function to print out array
int Search(int randArray[], int, int, int); //search for a #
int main()
{
srand(time(NULL)); //sets random seed for generating random numbers
int I_SIZE = 50;
int randArray[I_SIZE]; //set MAX size of array to 50.
int numtofind;
int result;
int x = 0;
int y = 0;
int first = 0;
int last = 49;
FillRand(randArray, x);
Print(randArray, y);
cout << "\nPlease enter in a number to find it's position or -99 to quit: " << endl;
cin >> numtofind;
result = Search(randArray, first, last, numtofind);
if ( result == -1 )
{
cout << "Number not found" <<endl;
}
else
{
cout <<"Number is found in position " << result << endl;
}