If my file finished with the word whose frequency i have to calculate then it will give one more than actual value other wise it is ok.
int n=0;
char search[40];
cin>>search;
char* a=search;
while(fin){
char c[40];
fin>>c;
char* b=c;
if(*a==*b)
n++;
}
cout<<n;
How can i overcome the problem even if i use strcmp then still same thing happens.