This assignment is called a co-currence problem. The point of my program is to read in sentences from a file and ignore any punctuation. Then, I will read user input where the user will enter words separated by a space only and I have to search for those exact words in all the sentences of the file and return the line number where all the words are found.
My approach now is to create a pointer array to other arrays that contain the words for each sentence.
ifstream read;
string filename;
string **txtPtr = nullptr;
int numLines = 0;
getFileName();
getNumLines(read, fileName); //stores # of lines into numLines
txtPtr = new string*[numLines];
My question is, can I pass the pointer to a function as string *lines
or string *lines[]
?