diff --git a/code/Apostropheqq.cpp b/code/Apostropheqq.cpp new file mode 100644 index 0000000..0af78b4 --- /dev/null +++ b/code/Apostropheqq.cpp @@ -0,0 +1,21 @@ +#include +using namespace std; +void reverse(const string& a); +int main() +{ +string str; +cout << " Please enter a string " << endl; +getline(cin, str); +reverse(str); +return 0; +} +void reverse(const string& str) +{ +size_t numOfChars = str.size(); +if(numOfChars == 1) +cout << str << endl; +else + { +cout << str[numOfChars - 1]; + reverse(str.substr(0, numOfChars - 1)); + }