Wite a C++ program to count the word "he" and "she" present in file "story.txt".
Answers
Answered by
2
Answer:
#include<iostream.h>
#include<fstream.h>
#include<string.h>
int main()
{
ifstream fin("story.txt");
int count1=0, count2=0;
char ch[200],c[200],c2[200];
c1 = "he";
c2 = "she";
while(fin)
{
fin>>ch;
if(strcmp(ch,c1)==0)
count1++;
if(strcmp(ch,c2)==0)
count2++;
}
cout<<"Occurrence="<<count1<<" "<<count2<<"n";
fin.close();
return 0;
}
Answered by
1
Answer: HERE NO ONE WILL ANSWER IT
YOU CAN SEARCH ON GOOGLE IT WILL REALLY HELP YOU
Explanation:
Similar questions