hey guys. This is my question.
Give a file, find number of occurrences of a search string with line numbers in which this tring occurs...
My problem: my code only gives first occurrence and line number
My problem: my code only gives first occurrence and line number
It looks like it didn't find the first occurrence but the one that exactly matches on line 3. It skipped the one where the phrase started differently.
if(filetext[j]==search[j])
I'm not sure, but it looks like you might be comparing character 1 of the string in the file with character 1 of the string you are searching for. If the file string starts with a different character, they aren't going to match up.
Minipaa and Wildblue correct...But how am i going to bypass this error? Is there any way except by pointers? because I am only required to use cstring...thanks all