palindrome

Mar 1, 2013 at 6:20am
what is palindrome fmction in c plus plus?
Mar 1, 2013 at 7:01am
1
2
3
4
5
6
7
bool is_palindrome(std::string str)
{
    for (int start = 0, end = str.size()-1; start < end; ++start, --end)
        if (str.at(start) != str.at(end)) 
            return false;
    return true;
}
Last edited on Mar 1, 2013 at 7:02am
Topic archived. No new replies allowed.