1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#include <iostream> using namespace std; void s(int i, int k, int n, char str[]); int main() { char ss[] = "SANTO"; s(0, 4, sizeof(ss), ss); return 0; } void s(int i, int k, int n, char str[]) { if(i < n - k){ if(i < n-k) for(int j = i; j < i+k; j++) cout << str[j]; cout << "\n"; s(i+=1, k, n, str); } }