Can someone help me in a borland c++ code?
i already have a memo field and i want to count the words, i count the blanks but i have problem when appears 2 or more blanks together and when i write to the second line..
Also can anybody tell me how to print the memo index as a text?
sounds like you are on the right track.. counting the number of spaces is probably the easiest way to calculate the number of words in a file.. but as you have already identified.. one could run into trouble if there are multiple spaces in between words..
so why not identify the number of situations where there is a space and the next character is not a space...
Haven't seen any of your code.. but here is my guess:
int i=0, word_count=0;
//If no text head been read, exit the function
//Test to see if there are any non-white spaces
while(!Flag && myText.substring(i, 1))
cout << "No Text Entered!";
//Perform word count - first word
if(isspace(myText.substring(i, 1)) && !isspace(myText.substring(i+1, 1)))
//"First Word" provision
like i said.. haven't seen any of your code.. just throwing something your way to think about :cool: