Created
March 23, 2017 05:15
-
-
Save mesbahamin/b016a496d669553bef4c12b468c6903e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
using namespace std; | |
void recursive(string s, int count, int limit) | |
{ | |
if (count < limit) | |
{ | |
for (int i = 0; i < count; i++) | |
{ | |
cout << ' '; | |
} | |
cout << s[count]; | |
for (int i = count + 1; i < limit; i++) | |
{ | |
cout << '|'; | |
} | |
cout << endl; | |
recursive(s, ++count, limit); | |
} | |
} | |
int main() | |
{ | |
bool quit = false; | |
string input = "Ah yes, recursion..."; | |
cout << input << endl; | |
do { | |
recursive(input, 0, input.length()); | |
cout << "Enter another message (or type 'Quit' to quit:" << endl; | |
getline(cin, input); | |
if (input == "Quit") | |
{ | |
quit = true; | |
} | |
} while(!quit); | |
system("pause"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment