Hi Guys Im looking for someone who can translate this c++ code to pseudocode .
#include <algorithm>
#include <cctype>
#include <functional>
#include <string>
bool palindrome( unsigned long n )
{
unsigned long x = n;
unsigned long u = 0;
while (x)
{
u *= 10;
u += x % 10;
x /= 10;
}
return (n == u);
}
bool palindrome( std::string s )
{
s.erase(
std::remove_if(
s.begin(),
s.end(),
std::not1( std::ptr_fun <int, int> ( std::isalnum ) )
),
s.end()
);
std::transform( s.begin(), s.end(), s.begin(), std::ptr_fun <int, int> ( std::tolower ) );
std::string z = s;
std::reverse( z.begin(), z.end() );
return (s == z);
}
#include <iostream>
#include <limits>
using namespace std;
int main()
{
string s;
unsigned long n;
cout << "Palindrome tester\n";
cout << "Enter nothing to quit.\n";
while (true)
{
cout << "Enter a string> ";
getline( cin, s );
if (s.empty()) break;
cout << "Enter a number> ";
cin >> n;
if (!cin) cin.clear();
cin.ignore( numeric_limits <streamsize> ::max(), '\n' );
cout << "The string is " << (palindrome( s ) ? "" : "not ") << "a palindrome.\n";
cout << "The number is " << (palindrome( n ) ? "" : "not ") << "a palindrome.\n\n";
}
cout << "Good bye.\n";
return 0;
}
Thanks..