generated from freudenreichan/info2Praktikum-Wortsalat
Added Method showWordSalad
This commit is contained in:
parent
db23fa232e
commit
5be62312c2
@ -2,6 +2,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#define MAX_RAND_TRIES_PER_WORD 10
|
#define MAX_RAND_TRIES_PER_WORD 10
|
||||||
#define EMPTY_CHAR 0
|
#define EMPTY_CHAR 0
|
||||||
@ -19,5 +20,19 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
|
|||||||
// Prints the word salad to console
|
// Prints the word salad to console
|
||||||
void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen)
|
void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen)
|
||||||
{
|
{
|
||||||
|
if(searchFieldLen <= MAX_SEARCH_FIELD_LEN)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < searchFieldLen; i++)
|
||||||
|
{
|
||||||
|
for(int j = 0; j < searchFieldLen; j++)
|
||||||
|
{
|
||||||
|
putchar(salad[i][j]);//Prints a letter within the salad array
|
||||||
|
}
|
||||||
|
putchar(10);//Prints a Line Feed, thus ensuring the correct formatting of the program
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
puts("FEHLER! Buchstabenfeld uebersteigt Maximalzahl der Buchstaben!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user