Kreij
Senior Monkey Moderator
- Joined
- Feb 6, 2007
- Messages
- 13,817 (2.20/day)
- Location
- Cheeseland (Wisconsin, USA)
Here ya go , Alek. Palindrome code for a word or perfect palidrome phrase ...
Code:
string inputString;
bool IsPalindrome = true;
// Get input string however
for (int i = 0; i < intputString.Length(); i++)
{
if (inputString[i] != inputString[(inputString.Length() - 1) - i])
{
IsPalindrome == false;
break;
}
}
if (!IsPalindrome)
{
// output the it's not a palindrome
}
else // output that it is a palindrome
This is why coders have problems with relationships. The women keep feeding our "compilers" with ambiguous references and we keep getting unhandled exceptions.d.d.d said:Alek, to me the best way to learn was to think like the compiler.
Last edited: