Advertisement
Guest User

Untitled

a guest
May 19th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.02 KB | None | 0 0
  1. #include "stdafx.h"                             // default include
  2. #include <iostream>                             // input / output stream include for user interaction
  3. #include <string>                               // include that allows us to manipulate strings
  4.  
  5. using namespace std;                            // standard namespace
  6.  
  7. void stringReverse(int&, string&);              // function to reverse the string passing in the length
  8.                                                 //   and string itself as values
  9.  
  10. string getStringToReverse();                    // function to get string and store in local variable
  11.  
  12. // =================
  13. // = Main Program: =
  14. // =================
  15. int _tmain(int argc, _TCHAR* argv[])
  16. {
  17.     // Local Variables for string to reverse and string length
  18.     string strToReverse;
  19.     int strLength = 0;
  20.  
  21.     strToReverse = getStringToReverse();        // retrieve character from user
  22.     strLength = strToReverse.length();          // store length for reverse function
  23.     cout << endl << "Your string reversed is: ";
  24.     stringReverse(strLength, strToReverse);     // reverses string and output results
  25.     cout << endl << endl;
  26.  
  27.     system("PAUSE");
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement