Hey I'm working on an exercise where the program creates five different sets of lottery numbers. Each set of numbers are supposed to contain unique numbers. I am using a 2-D int array to store the numbers, and also a 2-D bool array to mark true in the location of a number if it has already been used. I'm using a while loop to check the bool array and make sure the random number hasn't already been used. Here's my problem. I can print the random numbers but they're not always unique. I have been trying to figure this out for hours. PLEASE HELP!!!!
Oh and to make sure every thing is right, move the lotteryNumbers and uniqueNumber declarations outside the main functions, that way there are always initialized to 0 so you don't have to write a loop to do the initialization.
You sir, are a genius. I tried everything I could think of to get this to work even got as far as while(uniqueNumber[i][selection] = true, but it never occurred to me that I need 'is equal to' when dealing with booleans. I knew it was something small though, it had to be. Anyway, thank you very much. Now I can go to sleep. :)