Write function definition for WORD4CHAR() in C++ to read the content of a text file FUN.TXT, and display all those words, which has four characters in it.
Example:
If the content of the file fun.TXT is as follows:
When I was a small child, I used to play in the garden
with my grand mom. Those days were amazingly funful
and I remember all the moments of that time
The function WORD4CHAR() should display the following:
When used play with days were that time
void WORD4CHAR()
{
ifstream Fil;
Fil.open(FUN.TXT);
char W[20];
Fil>>W;
while(!Fil.eof())
{
if ((strlen(W)) == 4){
cout<<W<< ;
}
Fil>>W;
}
Fil.close();
}