Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h" // default include
- #include <iostream> // input / output stream include for user interaction
- #include <string> // include that allows us to manipulate strings
- using namespace std; // standard namespace
- void stringReverse(int&, string&); // function to reverse the string passing in the length
- // and string itself as values
- string getStringToReverse(); // function to get string and store in local variable
- // =================
- // = Main Program: =
- // =================
- int _tmain(int argc, _TCHAR* argv[])
- {
- // Local Variables for string to reverse and string length
- string strToReverse;
- int strLength = 0;
- strToReverse = getStringToReverse(); // retrieve character from user
- strLength = strToReverse.length(); // store length for reverse function
- cout << endl << "Your string reversed is: ";
- stringReverse(strLength, strToReverse); // reverses string and output results
- cout << endl << endl;
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement