#include "stdafx.h" #include <iostream> using namespace std; void Rotate(string s, int len); int main() { char s[20]; // Input cout << "Enter string: "; cin >> s; string t = s; if (t.length() != 0) { cout << "\n------------\n"; Rotate(t, t.length()); cout << "\n------------"; } else cout << "Missing input!"; getchar(); getchar(); return 0; } void Rotate(string s, int len) { static int i = 0; cout << "\""; for (int j = i; j<len; ++j) { cout << s.at(j); } for (int k = 0; k<i; ++k) { cout << s.at(k); } cout << "\""; i++; if (i<len) { cout << endl; Rotate(s, len); } }
Output