From 9ef55c581f20b45ae15fc5681d84fe6431cec4a9 Mon Sep 17 00:00:00 2001 From: Hofmann Jonas Date: Tue, 11 Nov 2025 07:58:07 +0100 Subject: [PATCH] added comments to input.c and tested the programm again --- Start_Windows/input.c | 9 +++++++++ Start_Windows/input.o | Bin 3245 -> 3245 bytes Start_Windows/runTests.exe | Bin 94806 -> 94806 bytes Start_Windows/wordsalad.exe | Bin 1139942 -> 1139942 bytes 4 files changed, 9 insertions(+) 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 06a1909e935cccc3fa13be35699b8d41f079b949..d58c6346ba64554b9e6d72661c5907ae048c4862 100644 GIT binary patch delta 56 zcmZ20xmI!mJG*KCt0)5#3*#5G##UAcIvggH@=URhdJGRrDmQVD@Akb`{3# J&4KJOtN1r-1S1Od7Q3_z1@z8L{)lZU<} K0c*3YzN)hxloVC~ delta 52 zcmV-40L%Z@z8L{%lZU<} K0cf+VzN)hj_!IO1 diff --git a/Start_Windows/wordsalad.exe b/Start_Windows/wordsalad.exe index 4e19cac13df22ed038dfcd6feeed02b54268bc42..1c1405dedc2c33b3607a088666b8a70e7b4d4f55 100644 GIT binary patch delta 106 zcmaEM()HO%*9jfW7WafEcKb3jhYK~{ZoSRedYh^BHgoH3me$*>t+&})Z?m`F=4idm z*?OC+^)`3wZJw>Sc_ZF%2e67VFtIT1V&!p|Zugc~k}-RF#9Lk!#_aamx4b~i2gLl_ KYu^fFmIDBsAS`hJ delta 106 zcmaEM()HO%*9jfWzE)flyM38?*9tb?ZoSRedYh^BHgoH3me$*>t+&})Z?m`F=4idm z*?OC+^)`3wZJw>Sc_ZF%`?HENFtIT1V&$=$Zugc~k}+d?#9Lk!#*Fsbx4b~i2gLl_ KYu^fFmIDBTyDTsO