I am supposed to count the number of times the word "the" appears in a file. i have to count it case sensitively("THE", "The") and case insensitively("the")
My problem is, with the code below, i get 0 or some huge number(32780) instead of 96 and 72.
In the first function count does not contain number of words because words is not converted to upper case except their first character.
In the second and the first functions count was not initialized.
maybe im missing something vlad, but a) what happens if he passes "log" to countWords, and word is "LOG" i dont remember "log" == "LOG". im not trying to start an arguement with you. im just trying to understand your code.
and also did you mean size_t on line 17? i googled isize_t and came up with nothing
In line 17 there was a typo that I corrected.
As for the function then I used the same logic as it is in the original post. It is obvious that it is supposed that the argument shall be in uppercase.