Translating to pseudocide!!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#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;
  }


Guys I need your help to convert this code to pseudocode.

Thanks.
Can you describe in words what each section does?
This looks like something Duoas would write. Did you copy it from some other post in this site?
closed account (z05DSL3A)
Maybe he want to know how it works and can't ask in the original thread as it's archived.
(but should still have referenced it)

Edit:
The title, Translating to pseudocide!!, did tickle me.
Last edited on
pseudocide = pseudo suicide =)
Topic archived. No new replies allowed.