ya_makaron

рекурсия шереметы 2

Apr 29th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. void func(char *str)
  4. {
  5.     static char new_str[128];
  6.     static int counter = 0;
  7.     if (str[0] && str[1])
  8.     {
  9.         new_str[counter] = *str;
  10.         new_str[counter + 1] = '*';
  11.         str++;
  12.         counter += 2;
  13.         func(str);
  14.     }
  15.     else
  16.     {
  17.         new_str[counter] = *str;
  18.         std::cout << new_str << std::endl;
  19.     }
  20. }
  21.  
  22. int main()
  23. {
  24.     func("LItBeoFLcSGBOFQxMHoIuDDWcqcVgkcRoAeocXO");
  25.     system("pause");
  26.     return 0;
  27. }
Add Comment
Please, Sign In to add comment