Il problema dovrebbe essere che ridichiari start e end nel metodo ogni volta, io ho provato questo e funziona:
Ciaocodice:bool is_palindrome(string s,int start,int end) { if(s.length()<=1) { return true; } else { if(s[start]!=s[end])return false; else { while(start<end){ start++; end--; is_palindrome(s,start,end); } } } }![]()

elf90 g77
Rispondi quotando