#include <iostream>#include <vector>using namespace std;// I declared this class as string rather than bool because in C++, a bool would be outputed as 1/0, instead of "true"/"false"string isPalindrome(string str){ string tmp; // Loop through the string in reverse and add characters to tmp in reverse order for(int i = str.size(); i >= 0; i--) tmp += str.substr(i, 1); // If str == tmp, return true, if it doesnt, return false if(strcmp(str.c_str(), tmp.c_str()) == 0) return "true"; else return "false";}int main(){ // Define the two variables to be tested string s1 = "radar"; string s2 = "total"; cout << "Analizing: \"" << s1.c_str() << "\" and \"" << s2.c_str() << "\"...\n"; // Test s1 cout << s1.c_str() << ": " << isPalindrome(s1).c_str() << endl; // Test s2 cout << s2.c_str() << ": " << isPalindrome(s2).c_str() << endl; // Wait for input to end. "Press Any Key To Continue" getchar(); return 1;}