+ 1
Palindrome using string
check for a number and a character whether it is palimdrome or not
3 Respostas
+ 2
Try for a recursive algorithm:
1. if the string has length <=1, it's a palindrome.
2. else, the string is a palindrome if its initial and ending characters are equal, and the inner characters form a palindrome string.
0
This code should reverse the stirng
#include <iostream>
using namespace std;
int main() {
string s;
char c;
int l;
s="sololearn";
l=s.size();
for(int i=0;i<s.size()/2+1;i++){
c=s[i];
s[i]=s[l-i-1];
s[l-i-1]=c;
}
cout<<s;
}
the output is "nraelolos" and then you compare the strings