Write a function to count number of words in a text file named "OUT.TXT"

Share
void countwords()
{
	ifstream fin;
	fin.open("out.txt");
	char word[30];
	int count=0;
	while(!fin.eof())
	{
		fin>>word;
		count++;
	}
	cout<<"Number of words in file are "<<count;
	fin.close();
}
Share

Comments

comments

Tags: , , , ,

One Response to “Write a function to count number of words in a text file named "OUT.TXT"”

  1. バーバーリコピー says:

    だから同姓にも好感が持たれないし異性も警戒心を持つ

Leave a Reply