forked from schroederen/info2Praktikum-Wortsalat
Compare commits
No commits in common. "be5b6adc0be8309805e37e69a838147936a280cc" and "4f0c599056d236c29d023f48ed6dd97a7dde38b9" have entirely different histories.
be5b6adc0b
...
4f0c599056
@ -11,7 +11,6 @@
|
|||||||
* @return Anzahl der eingelesenen Wörter
|
* @return Anzahl der eingelesenen Wörter
|
||||||
*/
|
*/
|
||||||
// Read words from file and store in 'words' array
|
// Read words from file and store in 'words' array
|
||||||
// ERLEDIGT
|
|
||||||
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
||||||
{
|
{
|
||||||
if (file == NULL || words == NULL || maxWordCount == 0) {
|
if (file == NULL || words == NULL || maxWordCount == 0) {
|
||||||
|
|||||||
@ -37,22 +37,10 @@ int main(int argc, char *argv[])
|
|||||||
placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount);
|
placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount);
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
|
|
||||||
// Check if all words were successfully placed
|
// Check if all words were successfully placed
|
||||||
if(placedWords == wordCount)
|
|
||||||
{
|
|
||||||
// Start the game if successful
|
// Start the game if successful
|
||||||
printf("All %u words were successfully placed in the word salad!\n", wordCount);
|
// error message if some words couldn't be placed
|
||||||
createWordSalad(wordSalad, SALAD_SIZE, words, wordCount);
|
|
||||||
showWordSalad(wordSalad, SALAD_SIZE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Error message if some words couldn't be placed
|
|
||||||
fprintf(stderr, "Error: Only %u out of %u words could be placed in the word salad.\n",
|
|
||||||
placedWords, wordCount);
|
|
||||||
exitCode = EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user