0
Write a program that will enter the string from the user and count the number of words????plz help me
3 ответов
+ 4
in a loop, keep reading the next character.
if the character is a separator, increment the word count and keep reading until the next non-separator is found.
+ 3
@Joshnu : counting number of whitespaces will give a wrong number of there are more that one whitespace between words.
0
check for whitespaces as a white space separates word. and fullstops in case of sentences.
if(a[i]==' ') count++;//inside a for loop, count indicates the no of white spaces, is words. hope this helps