// Chapter 2, p 92 #include #include const int MAX_LENGTH = 30; typedef char stringType[MAX_LENGTH+1]; void WriteBackward(stringType S, int Size) // Recursive version { if (Size > 0) { // write the last character cout << S[Size-1]; // write the rest of the string backward WriteBackward(S, Size - 1); // Point A } // end if // Size == 0 is the base case - do nothing } // end WriteBackward void WriteBackward(stringType S, int Size) // Iterative version { while (Size > 0) { cout << S[Size-1]; // write the last character --Size; } // end while } // end WriteBackward