While loop blues
Posted on 2001-09-18
I must be missing something easy, here, but I can't see it offhand.
I'm building a scheduler for a sports select type website. This scheduler will take a certain number of teams, and schedule them to play a set amount of games on various days throughout the season.
I have a two dimensional array of type entry (contains three integer values).
Now when I find out the day the team is scheduled to play it's nth game, I want to check the rest of the array for this team to determine if the day has already been assigned. (denoted by an integer) Here is the code I used:
while (blnLegalDay == FALSE)
tmpRand1 = rand();
tmpDay = (tmpRand1 % NumberOfDays) + 1;
Counter = 0;
if (tmpDay == Schedule[i][b].day)
if (Counter > 0)
blnLegalDay = FALSE;
blnLegalDay = TRUE;
It never seems to check the array to make sure the tmpDay equals the day value in the array. blnLegalDay always equates to TRUE, giving me more than one game scheduled on the same day. Any ideas on what I might have missed?