And in case you can't get <filesystem> working, note that: if (!infile.is_open()&&!outfile.is_open()) is not what the requirement is.
An outfile not opening successfully means that the outfile was not created, which is either a matter of permissions, OS restrictions, or hard-drive space.
Your requirement says to check if the input file exists, and in this case it's good enough to just check if it's opened successfully, because that's what really matters.
In other words, your condition here could just be:
1 2
if (!infile.is_open())
cout << "Input file not found" << endl;