We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b644b43 commit 11d9b95Copy full SHA for 11d9b95
main.cpp
@@ -64,6 +64,27 @@ char* flip5(char *input) {
64
return input;
65
}
66
67
+void flip6(string input) {
68
+ for(int index=input.length()-1; index>=0; index--)
69
+ cout << input[index];
70
+}
71
+
72
+char* flip7(char const* input) {
73
+ int length = strlen(input);
74
+ char *temp = new char[length+1];
75
+ strcpy(temp, input);
76
+ for(int index=0, counter=length-1; index<counter; index++,counter--)
77
+ swap(temp[index], temp[counter]);
78
+ return temp;
79
80
81
+void flip8(string &input)
82
+{
83
+ int length = input.length();
84
+ for(int index = 0; index < length/2; index++)
85
+ std::swap(input[index], input[length-index-1]);
86
87
88
void check(string input) {
89
const unsigned int size=input.length();
90
const unsigned int middle=size / 2;
0 commit comments