Originally Posted by
gp364481
Hey, new here
I have a problem.
I need to read in a string of chars (upper/lower case letters and punctuation marks : '.' or ',' or ';' or '?' or '!') of unspecified length, then take each one of the words and process some calculations such as : average length of a word, average vowels in each word, how many words are between 10 and 15 letters long etc..
An example input would be:
Hello there! How are you?
I read a string in using the keyboard and I use strtok from the <string.h> library to break the string down to individual words. The problem is that the words in the string can be seperated by any white space characters not just by the spacebar.
Iam using something like :
char line[MAX_SIZE];
strtok( line, " ");
so I can break the string into words. But I am only limited to words that are seperated by the spacebar " ".
How do I take each word seperately from the input string and run the calculations on it ?
Thanks in advance
gp