generated from freudenreichan/info2Praktikum-Wortsalat
funktion showWordSalad ergänzt, fehler in placeRandomLetters korrigiert
This commit is contained in:
parent
f407d5a36f
commit
2f625c98b9
@ -129,12 +129,9 @@ void placeRandomLetters(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN],
|
||||
{
|
||||
for (j = 0; i < searchFieldLen; j++)
|
||||
{
|
||||
if (salad[i][j])
|
||||
if ((salad[i][j] < 'A') && (salad[i][j] > 'z'))
|
||||
{
|
||||
if ((salad[i][j] < 'A') && (salad[i][j] > 'z'))
|
||||
{
|
||||
salad[i][j] = rand()%('Z' - 'A' + 1) + 'A';
|
||||
}
|
||||
salad[i][j] = rand()%('Z' - 'A' + 1) + 'A';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -171,7 +168,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
|
||||
|
||||
placeRandomLetters(salad, searchFieldLen);
|
||||
|
||||
|
||||
|
||||
return placedWords;
|
||||
}
|
||||
|
||||
@ -179,6 +176,17 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
|
||||
// Prints the word salad to console
|
||||
void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen)
|
||||
{
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
|
||||
|
||||
for (i = 0; i < searchFieldLen; i++)
|
||||
{
|
||||
for (j = 0; i < searchFieldLen; j++)
|
||||
{
|
||||
printf("%c", salad[i][j]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user