September 23rd, 2003, 09:57 PM
functions I need help
I have a prgram that I am writing the function reads and writes blanks. Whenever it hits a nonblank, except for whitespace characters, like tab etc, it increments the number of words on a line. At first reading the assignment my thought was that it would count blanks. It is reading from an input file and writing to an output file. Now if my file reads something like this
My name is Name and I live somewhere.
Wouldn't it read each character as a word?? See I thought that it would look for blanks, so it would read a charater than go to the next until it got to a blank than that would tell it that it had read a word
example of the code I have not finished it yet just starting to get a feel
char processBlank(char& blanks)
for(bcounter = 1; blanks == ' '; bcounter ++)
September 23rd, 2003, 10:46 PM
I think your logic will count all non-blank characters in your input. You will probably want to consider flags to indicate if you are in a word or in a series of blanks.