From c7bf836a8838eeea2ba10aa9cccce56ecac5e018 Mon Sep 17 00:00:00 2001 From: Apostropheqq Date: Sun, 7 Oct 2018 23:33:36 +0200 Subject: [PATCH 1/2] Create reversestrin.cpp --- code/reversestrin.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 code/reversestrin.cpp diff --git a/code/reversestrin.cpp b/code/reversestrin.cpp new file mode 100644 index 0000000..0af78b4 --- /dev/null +++ b/code/reversestrin.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)); + } From 6c1f8ffa4a4943a1a015f0e809f68b06c185c625 Mon Sep 17 00:00:00 2001 From: Luke Oliff Date: Mon, 8 Oct 2018 17:45:22 +0100 Subject: [PATCH 2/2] Rename reversestrin.cpp to Apostropheqq.cpp --- code/{reversestrin.cpp => Apostropheqq.cpp} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename code/{reversestrin.cpp => Apostropheqq.cpp} (100%) diff --git a/code/reversestrin.cpp b/code/Apostropheqq.cpp similarity index 100% rename from code/reversestrin.cpp rename to code/Apostropheqq.cpp