#include<iostream.h>
#include<fstream.h>
#include<conio.h>
#include<string.h>
void main()
{
ifstream fin("msg.txt");
char word[5];
int count=0;
cout<<"CONTENTS OF FILE IS :- \n";
while(fin)
{
fin>>word;
cout<<word<<" ";
if(!strcmpi(word,"is"))
{
count++;
}
}
cout<<"\nNumber of appearance of \"is\" = "<<count;
getch();
}
It's an attempt to help all C.Sc. students (of Class 11 and 12). Search for your needs, for better search try labels (at right sidebar), and message your reviews and requests. Have a Pleasant Programming !! :)
Make Your Search Easy ! :) Use me
Friday, February 17, 2017
Counting number of occurrences of a word ("is") in a file :-
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment