Write a recursive function that takes a string as input. This recursive function should open a file by the name of the string, and read the first word. Then attempt to open a file by the word you just read and repeat this process. This ends, when there is no file with the name you are looking for. At this point, cout the last word in the current file (the one where the first word was not a different file).
So for example if you have three files: "hi.txt" contains: moo is happy cow "moo" contains: im actually a sad cow "cow" contains: the cow is a lie
If you ran this recursive function on "hi.txt", you would find the first word in this file is "moo". "moo" is an actual file, so we open it. The first word in "moo" is "im". There is no file "im", so we would just cout "cow". (Ensure you do not write the function for this specific example... but any combinations of files and words.)