diff --git a/Start_Windows/input.c b/Start_Windows/input.c index dd57252..ddb59b8 100644 --- a/Start_Windows/input.c +++ b/Start_Windows/input.c @@ -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; + wordChar = 0; + currentlyInWord = 0; } - i++; } while ((currentChar != EOF) && (word < maxWordCount)); diff --git a/Start_Windows/input.o b/Start_Windows/input.o index f3c4fb9..37206ff 100644 Binary files a/Start_Windows/input.o and b/Start_Windows/input.o differ diff --git a/Start_Windows/runTests.exe b/Start_Windows/runTests.exe index 37e5415..86bc440 100644 Binary files a/Start_Windows/runTests.exe and b/Start_Windows/runTests.exe differ diff --git a/Start_Windows/wordsalad_myversion.exe b/Start_Windows/wordsalad_myversion.exe index b2a74a5..5069f8a 100644 Binary files a/Start_Windows/wordsalad_myversion.exe and b/Start_Windows/wordsalad_myversion.exe differ