1: // Created by Frank M. Carrano and Timothy M. Henry.
2: // Copyright (c) 2017 Pearson Education, Hoboken, New Jersey.
4: void encodeString(int numChar, std::string& str)
5: {
6: try
7: {
8: for (int i = numChar − 1; i >= 0; i––)
9: encodeChar(i, str);
10: }
11: catch (std::out_of_range e)
12: {
13: std::cout << "The string does not contain " << numChar;
14: std::cout << " characters." << std::endl;
15: std::cout << e.what() << std::endl;
16: } // end try-catch
17: } // end encodeString