When I try to run this it compiles but gives me no output. I'm trying to make a lotto game where the user enters 5 numbers between 1 and 47 and those numbers are compared to an array that is randomly filled with 6 numbers between 1 and 47. Then I need to print the numbers that the user chose, state how many matched, and list which ones matched. <-- This last part I don't know how to do. Please help me with this as well as let me know why its compiling with no output. If it helps, I'm using Codeblocks.
void main ()
/*Generates random numbers to fill the official lotto array without repetition.
lotto is a buffer with unique numbers.
sizeLotto is the size of the array.
candidate is a number that will be validated against lotto.
void randomNumberGenerator (int officialNumbers, unsigned int sizeOfficialNumbers,unsigned int maxNum)
if (maxNum < sizeOfficialNumbers)
printf("ERROR:max Number cannot be smaller than the size of the official array\n");
int currentSize = 0;
int candidate = rand() % maxNum +1;
officialNumbers [currentSize] = candidate;
//Prompts the user to choose lottery numbers and stores them in an array.
void getLotteryNums( int userNumbers )
printf("Enter 5 numbers betweeen 1 and 47\n");
for ( i=0; i<5; i++)
printf("Enter number %d: ", i+1);
int matchCandidate (int lotto,unsigned int sizeLotto, int candidate)
int i = 0;
for ( i=0; i<sizeLotto; i++)
if (candidate == lotto[i])
int userMatchNumbers (int userNumbers , int officialNumbers, unsigned int sizeUserNumbers, unsigned int sizeOfficialNumbers,
unsigned int storedNumbers)
unsigned int sizeStoredNumbers = 0;
for (; i<sizeUserNumbers; i++)
printf("INFO - comparing #%d value %d : ",i,userNumbers[i]);
if (matchCandidate (officialNumbers, sizeOfficialNumbers, userNumbers[i]))
storedNumbers [sizeStoredNumbers] = userNumbers[i];
printf("stored = %d\n",sizeStoredNumbers);
printf("INFO - stored number = ");
bool rptFunction (void)
char repeatAnswer = 'n';
printf("Do you want to play again? (n or N for no)\n");
return (repeatAnswer !='n' || repeatAnswer !='N');