Source of writeBackwardIterative.cpp


  1: //  Created by Frank M. Carrano and Tim Henry.
  2: //  Copyright (c) 2013 __Pearson Education__. All rights reserved.

  4: /** Iterative version. */
  5: void writeBackward(string s)
  6: {
  7:    int length = (int)s.size();
  8:    while (length > 0)
  9:    {
 10:       cout << s.substr(length - 1, 1);
 11:       length--;
 12:    }  // end while
 13: }  // end writeBackward