Compare commits

..

No commits in common. "main" and "input" have entirely different histories.
main ... input

7 changed files with 2 additions and 14 deletions

View File

@ -32,11 +32,8 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
do
{
// get the next char from the file
currentChar = fgetc(file);
// if current char is a capital letter
// write it into the words array
if ((currentChar >= 'A') && (currentChar <= 'Z'))
{
if (!currentlyInWord)
@ -47,9 +44,6 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
words[word][wordChar] = currentChar;
wordChar++;
}
// if the current char is a lowercase letter
// change it to its capital version
// and write it into the words array
else if ((currentChar >= 'a') && (currentChar <= 'z'))
{
if (!currentlyInWord)
@ -60,11 +54,8 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
words[word][wordChar] = toupper(currentChar);
wordChar++;
}
// if the current char is NOT a letter
// the end of a word has been reached
// skip chars untill a new letter is found
else if (currentlyInWord)
{
{
words[word][wordChar] = '\0';
word++;
wordChar = 0;
@ -72,6 +63,7 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
}
} while (((currentChar != EOF) && (word <= maxWordCount)));
printf("wortzahl: %d\n", word);
return word;
}

Binary file not shown.

Binary file not shown.

View File

@ -1 +0,0 @@
Hund,Katze; Maus

View File

@ -1,3 +0,0 @@
Apfel
Banane
Kiwi

Binary file not shown.