forked from freudenreichan/info2Praktikum-Wortsalat
Format Project
This commit is contained in:
4 files changed
+33
-39
No files matched your search
+8
-7
@@ -1,8 +1,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "input.h"
|
||||
#include "game.h"
|
||||
#include "graphicalGame.h"
|
||||
#include "input.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define MAX_NUMBER_OF_WORDS 100
|
||||
#define SALAD_SIZE 20
|
||||
@@ -11,7 +12,7 @@
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Check if the correct number of arguments is provided
|
||||
if(argc != 2)
|
||||
if (argc != 2)
|
||||
{
|
||||
fprintf(stderr, "Usage: %s <path to file with search words>\n", argv[0]);
|
||||
return EXIT_FAILURE;
|
||||
@@ -21,7 +22,7 @@ int main(int argc, char *argv[])
|
||||
unsigned int wordCount = 0;
|
||||
|
||||
FILE *file = fopen(argv[1], "r");
|
||||
if(file == NULL)
|
||||
if (file == NULL)
|
||||
{
|
||||
// Print error message if file couldn't be opened
|
||||
fprintf(stderr, "Could not open file %s for reading ...\n", argv[1]);
|
||||
@@ -35,7 +36,7 @@ int main(int argc, char *argv[])
|
||||
wordCount = readWords(file, words, MAX_NUMBER_OF_WORDS);
|
||||
fclose(file);
|
||||
|
||||
if(wordCount == 0)
|
||||
if (wordCount == 0)
|
||||
{
|
||||
fprintf(stderr, "No words found...\n");
|
||||
return EXIT_FAILURE;
|
||||
@@ -44,7 +45,7 @@ int main(int argc, char *argv[])
|
||||
// Create the word salad by placing words into grid
|
||||
placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount);
|
||||
|
||||
if(placedWords != wordCount)
|
||||
if (placedWords != wordCount)
|
||||
{
|
||||
fprintf(stderr, "Could not place %u out of %u words ...\n", wordCount - placedWords, wordCount);
|
||||
return EXIT_FAILURE;
|
||||
|
||||
Reference in new issue
Block a user