The below code is untested PHP. So you'll need to convert it to C++ and make sure it works, but it should definitely give you a good idea of how to get started. If you're unfamiliar with some of the PHP functions used below go to http://www.php.net and type it in where it says "search for" at the top right. Good luck!
// String which holds the potential palindrome. You can set it manually or get it from form data or where ever else.
$string = "potential palindrome";
// If you want the test to be case insensitive.
$string = strtolower($string);
// Int which holds the length of the above string (in this example it would be 20).
$length = count($string);
// Boolean which determines whether the string is a palindrome or not. We'll assume it is true unless the below code determines otherwise.
$palindrome = true;
// Loop through only the first half of the string (the reason for using floor is so that if the string doesn't divide evenly it means there is a character in the middle so we don't have to bother making sure it is the same as itself).
for($i = 0; $i < floor($length/2); $i++){
// Check to see if the current letter matches the letter on the opposing side. So the first test would check for position 0 ("p") and position 19 ("e"). The next test would be position 1 ("o") and position 18 ("m"). The final position would be 9 (" ") and 10 ("p").
if(substr($string, $i, 1) == substr($string, $length - $i - 1, 1)){
// The letters do match. Keep testing.
continue;
} else {
// The letters don't match, meaning the string is not a palindrome. Set the boolean to false and break out of the loop since no further testing is required.
$palindrome = false;
break;
}
}
// If the above code didn't change the boolean to false, it will remain true meaning the string is infact a palindrome.
if($palindrome){
echo "the following string IS a palindrome: " . $string;
} else {
echo "the following string IS NOT a palindrome: " . $string;
}