Palindromes

what would I need to put in my coding to see if what the user inputted was a palindrome... some sort of search function?
Hi
not clear what you really mean
1
2
3
std::string s1 = "anna";
std::string s2 = reverse(s1); // needs to be implemented
bool is_palindrome = (s1 == s2);
1
2
3
4
5
6
7
8
9
10
11
#include <algorithm>
#include <string>
using namespace std;

int main()
{
  string s1 = "anna";
  string s2 = s1;
  reverse(s1.begin(), s1.end()); // has been implemented
  bool is_palindrome = (s1 == s2); 
}
Very helpful! Exactly what I was looking for! Thanks guys
Topic archived. No new replies allowed.