Write a program find, which searches the files and prints all lines of these files containing a given word. The program is invoked with the command-line arguments. For example
find George report.txt all.txt me.txt
looks for the word George in the files report.txt, all.txt и me.txt.
Did you study such standard algorithm as std::find or std::any_of?
All what you need is to use function getline to read records sequentially and then apply either std::find or std::any_of for the read record considered as std::istringstream.
or, if you need to implement the algorithm yourself, compare each char, although I have no especial expertise in that field ;) But that would be my, at least first, approach to doing what you want to do.
The program is invoked with the command-line arguments. For example
find George report.txt all.txt me.txt
Also what is the word? For example used by you function will report that it has found the word "back" in line "seacrh backword". However if to consider the word as separated by spaces then there is no word "back" in the line.
First of all you should check that there were set at least two command line parameters that is argc shall be equal to or greater than 3.
Then in loop you can open files taking their names from the parameters.
For example
1 2 3 4 5 6
for ( int i = 2; i < argc; i++ )
{
std::ifstream fin( argv[i] );
if ( !fin ) /* issue some error ir warning message */;
// and so on