diff --git a/Start_Windows/input.c b/Start_Windows/input.c index 2039428..45bd9e5 100644 --- a/Start_Windows/input.c +++ b/Start_Windows/input.c @@ -32,8 +32,11 @@ 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) @@ -44,6 +47,9 @@ 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) @@ -54,6 +60,9 @@ 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'; diff --git a/Start_Windows/input.o b/Start_Windows/input.o index 06a1909..d58c634 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 c1fae29..55c693e 100644 Binary files a/Start_Windows/runTests.exe and b/Start_Windows/runTests.exe differ diff --git a/Start_Windows/wordsalad.exe b/Start_Windows/wordsalad.exe index 4e19cac..1c1405d 100644 Binary files a/Start_Windows/wordsalad.exe and b/Start_Windows/wordsalad.exe differ