Originally Posted by
andrew.bolster
you will of course take the time of the day into account
essentially, i was to count the number of occurrences of any of a list of substrings within a larger string, like the number of vowels in a word, but with more than one character being matched.
Like, counting punctuation marks in a line; tell the function you are looking for punctuation marks and, for instance, in this sentence it would say 5 . It doest matter that 2 are commas and one is a semicolon, you only care if that substring is in the string or not.
Code:
OK, I'd use a char array like target[] = {',', '.', ':', ';', ''',} and a simple variable to denote the number found.
while(char != '\0') { /* end of string marker */
Then
for {
each letter in the string, use a for loop to see if any of the char's match between
the target elements, and the char being checked in the string. Every one that matches,
increment the variable, found.
} /* end of for */
} /* end of while */
You are up late, Andrew! Get some sleep, guy.