Recursion. See attached file for full problem description.
The attached file recursion1.cpp is your original file with the two errors that prevented compiling corrected and marked by "//XXXXXXXXXXXXX"
After these corrections, it compiled and ran and did what is required.
In addition, I attach file strback.cpp which is made out of your original file ...