All pastes #1979283 Raw Edit

Untitled

public cpp v1 · immutable
#1979283 ·published 2010-11-02 02:35 UTC
rendered paste body
#include <iostream>#include <string>#include <algorithm>#include <cctype>bool isNotAlpha(char ch){	return !isalpha(ch);}bool isPalindrome(std::string sentence){	std::string::iterator newend = 			remove_if(sentence.begin(), sentence.end(), isNotAlpha);	sentence.erase(newend, sentence.end());	transform(sentence.begin(), sentence.end(), sentence.begin(), tolower);	std::string sentence_r = sentence;	reverse(sentence_r.begin(), sentence_r.end());	return (sentence == sentence_r);}int main(int argc, char** argv){	if (argc < 2)	{		std::cout << "With args next time." << std::endl;		return 0;	}	if (isPalindrome(argv[1]))	{		std::cout << "Is." << std::endl;	}	else	{		std::cout << "Isn't." << std::endl;	}	return 0;}