#include #include using namespace std; bool isPalindrome(string str) { string tmp; for(int i = str.size(); i >= 0; i--) tmp += str.substr(i, 1); if(strcmp(str.c_str(), tmp.c_str()) == 0) return true; else return false; return -1; } int main() { string s1 = "radar"; string s2 = "total"; cout << s1.c_str() << ": " << isPalindrome(s1); cout << s2.c_str() << ": " << isPalindrome(s2); getchar(); return 1; }