-
WordCount Program
Hey I am looking for a program in C++ that counts the words inputed by a user including any spaces. Usually something like this would give any output statement that tells the user the wordcount. I need this to reference something else for a project. This type of program is common so if anyone can help me out that would be great.
Thanks
Jmac
-
strtok() might work.
Look it up.
-
>>words inputed by a user including any spaces
Do you mean letters? If so just use strlen() or something. If you actually meant words separated by spaces then use strcspn() to search for spaces and figure out the count that way.
-
you're right it is common.. i posted about it a few weeks back.. strtok() is the answer.
GL