OK, so i'm working on a program that analyzes a paragraph and checks for the word 'the'.
So far I thought of making an if statement within a loop that checks if the word 'the' appears but it's pretty complicated and ugly.
Hmm...well, you could use tolower to avoid having to check for uppercase and lowercase. (So something like if (tolower(pgraph[count]) == 't' && /* ... */))
Also keep in mind that && has a stronger precedence than ||, so if (A || B && C) is equivalent to if (A || (B && C)), not if ((A || B) && C).
I'd imagine that the word "the" wouldn't be at the end of any sentence, and there should be a space between the end of a sentence and the first word of the next sentence, so you could probably just check for a space before and after each occurrence of "the".
You should also check the first word of the paragraph, since there probably won't be a space before it, and that word could easily be "the".