solution of question 4
[SET – 1]

User defined function in C++ to count the number of blank present in a text file named "OUT.TXT".

 

void blankspace()
{
	ifstream fin;
	fin.open("out.txt");
	char ch;
	int count=0;
	while(!fin.eof())
	{
		fin.get(ch);
		if(ch==' ')
			count++;
	}
	cout<<"Number of blank spaces in file are "<<count;
	fin.close();
}