1: // Created by Frank M. Carrano and Timothy M. Henry. 2: // Copyright (c) 2017 Pearson Education, Hoboken, New Jersey. 4: /** Iterative version. */ 5: void writeBackward(std::string s) 6: { 7: int length = s.size(); 8: while (length > 0) 9: { 10: std::cout << s.substr(length - 1, 1); 11: length--; 12: } // end while 13: } // end writeBackward