i am trying to write a function word(istream&, char*)that counts the words from the input file.
how to proceed? p lease suggest anybody.
I suggest finding your textbook. Open at the relevent page and then read. Might work. If not, post some code.
1. Check every character of the input stream one after the other.
2. If any of the characters is " " (space) and the next one is not " " space...increment the variable 'words' by 1.
for (int i=0;i!=(total_file_size_in_bytes);i++)
if (letter[i] == ' ' && letter[i+1] != ' ')