Advertisement
ya_makaron

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

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