Write a function in a C++ to count the number of lowercase alphabets present in a text file “NOTES.TXT”.

void countLower()
{
ifstream fin(“NOTES.TXT”);
char ch;
int count=0;
while(!fin.eof())
{
fin.get(ch);
if (islower(ch))
count++;
}
fin.close();
cout<<"There are "<<count<<" Lower case alphabets in NOTES.TXT file.";
}

void main()
{
countLower();
}





No comments

Post your comments

Powered by Blogger.