So in the previous thread I wasn't clear about the issue and I posted a lot of code.
I'm totally new to C Progamming and I encountered some issues.
I'm trying to create a Word Search, however I encountered a problem.
I'm trying to fill the Word Search Grid ( a 2D array) with random single characters) (Characters like A,B,C,D,E... )
I'm trying to use the rand()
function , however I can't get it to fill the whole 2D array. When I'm trying it I only can get it to fill the first slot.
This is the code where it fills the puzzle. At the moment I filled with with '.'
void createBlankPuzzle()
{
int i , j;
for(i = 0;i < ROWS;i++)
{
for(j = 0;j < COLUMNS;j++)
{
puzzle[i][j] = '.';
}
}
}
I'm trying to generate the random character with the rand()
function.
char getRandomCharacter()
{
int rl = (rand() % 26) + 65;
return (char)rl;
}
I hope this is clear enough and I tried to use good formatting.
Aucun commentaire:
Enregistrer un commentaire