Skip to content

Commit

Permalink
Updated for more clean code
Browse files Browse the repository at this point in the history
Added text when program runs to inform user, as well as added a variable to store the length of the string for ease.
  • Loading branch information
QQChowey authored Jan 5, 2017
1 parent ad981fd commit 343f441
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions challenge_1/cpp/chowey/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@

int main() {
std::string input;
std::cout << "Enter a string to be reversed:" << std::endl;
std::cin >> input;

for(int i = 1; i <= input.length(); i++) {
std::cout << input[input.length()-i];
length = input.length();

for(int i = 1; i <= length; i++) {
std::cout << input[length-i];
}
std::cout << std::endl;

Expand Down

0 comments on commit 343f441

Please sign in to comment.