CODING:
#include<fstream.h>
#include<conio.h>
main()
{
clrscr();
int count=1;
ifstream f1;
f1.open("student.txt");
f1.seekg(0);
char ch;
while(! f1.eof())
{
f1.get(ch);
}
if(ch==' '|| ch=='\t'|| ch=='\n')
{
count++;
}
cout<<"Number of
words="<<count;
f1.close();
getch();
return 0;
}
No comments:
Post a Comment