i want to do this: reads the words in the file one at a time. (Use a string to do this) Counts three things: how many single-character words are in the file, how many short (2 to 5 characters) words are in the file, and how many long (6 or more characters) words are in the file. HELP HERE
im not sure on how about reading file into a string. i know i have to something like this but i dont understand the rest. HELP HERE
ifstream infile;
//char mystring[6];
//char mystring[20];
int main()
{
infile.open("file.txt");
if(infile.fail())
{
cout << " Error " << endl;
}
int numb_char=0;
char letter;
while(!infile.eof())
{
infile.get(letter);
cout << letter;
numb_char++;
break;
}
cout << " the number of characters is :" << numb_char << endl;
infile.close();
return 0;