generated from freudenreichan/info2Praktikum-Wortsalat
removed unused variable in input.c
This commit is contained in:
parent
d097819ef9
commit
7146174e78
@ -24,8 +24,7 @@ char *readSingleWord(FILE *file)
|
||||
// Read words from file and store in 'words' array
|
||||
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
||||
{
|
||||
int i = 0;
|
||||
int firstLetter = 0;
|
||||
int currentlyInWord = 0;
|
||||
int word = 0;
|
||||
int wordChar = 0;
|
||||
char currentChar = 0;
|
||||
@ -37,9 +36,9 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
||||
|
||||
if ((currentChar >= 'A') && (currentChar <= 'Z'))
|
||||
{
|
||||
if (!firstLetter)
|
||||
if (!currentlyInWord)
|
||||
{
|
||||
firstLetter = 1;
|
||||
currentlyInWord = 1;
|
||||
}
|
||||
|
||||
words[word][wordChar] = currentChar;
|
||||
@ -47,23 +46,22 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
||||
}
|
||||
else if ((currentChar >= 'a') && (currentChar <= 'z'))
|
||||
{
|
||||
if (!firstLetter)
|
||||
if (!currentlyInWord)
|
||||
{
|
||||
firstLetter = 1;
|
||||
currentlyInWord = 1;
|
||||
}
|
||||
|
||||
words[word][wordChar] = toupper(currentChar);
|
||||
wordChar++;
|
||||
}
|
||||
else if (firstLetter)
|
||||
else if (currentlyInWord)
|
||||
{
|
||||
words[word][wordChar] = '\0';
|
||||
word++;
|
||||
wordChar = 0;
|
||||
firstLetter = 0;
|
||||
currentlyInWord = 0;
|
||||
}
|
||||
|
||||
i++;
|
||||
} while ((currentChar != EOF) && (word < maxWordCount));
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user