Skip to content

Commit c7033a1

Browse files
Alex Botelloerocs
Alex Botello
authored andcommitted
[C++] Challenge 1 (ReadyForMerge) (#454)
* [C++] Challenge 1 * Add newline output
1 parent 3985938 commit c7033a1

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

challenge_1/cpp/alexbotello/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Reverse String
2+
###### Language Version (C++ 11)
3+
4+
We use a For loop to iterate through the string starting at the last element.
5+
At each element print the output.
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include <iostream>
2+
#include <string>
3+
using namespace std;
4+
5+
int main()
6+
{
7+
string input;
8+
9+
cout << ">: ";
10+
getline(cin, input);
11+
12+
for (int i = input.length(); i >= 0; i--)
13+
{
14+
cout << input[i];
15+
}
16+
cout << endl;
17+
18+
return 0;
19+
}

0 commit comments

Comments
 (0)