From 2d7eb043c3aa65ce1611850fcb1ede6b480588fb Mon Sep 17 00:00:00 2001 From: Brett Weiland Date: Thu, 12 Nov 2020 12:10:17 -0600 Subject: new file: makefile new file: string_shit.cpp --- a | Bin 0 -> 24840 bytes makefile | 2 ++ string_shit.cpp | 31 +++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100755 a create mode 100644 makefile create mode 100644 string_shit.cpp diff --git a/a b/a new file mode 100755 index 0000000..74edae7 Binary files /dev/null and b/a differ diff --git a/makefile b/makefile new file mode 100644 index 0000000..66f7ebb --- /dev/null +++ b/makefile @@ -0,0 +1,2 @@ +make: + g++ -o a string_shit.cpp diff --git a/string_shit.cpp b/string_shit.cpp new file mode 100644 index 0000000..4df2503 --- /dev/null +++ b/string_shit.cpp @@ -0,0 +1,31 @@ +#include +#include +#include +#include + +using namespace std; +int main() { + string input; + string input_mod; + while(true) { + cout << "\nType in a string.\n"; + getline(cin, input); + + input_mod = input; + reverse(input_mod.begin(), input_mod.end()); + cout << "\nString in reverse order:\t\t\t\t" << input_mod << "\n"; + + + cout << "Number of characters in string:\t\t\t\t" << input.length() << "\n"; + + input_mod.erase(remove_if(input_mod.begin(), input_mod.end(), ::isspace), input_mod.end()); + cout << "Number of characters in the string, excluding spaces:\t" << input_mod.length() << "\n"; + + cout << "Would you like to exit? (y/n)\n"; + getline(cin, input); + if(input.at(0) == 'y'){ + return 0; + } + + } +} -- cgit v1.2.3