Main Page. VBA, ASP, Visual Basic 6.0, and VB.net. Visual C++, C#, C++, C. HTML and maybe javascript. Forum,Games and Jokes, other stuff. Submit a Tutorial Today!

program palindrome (input, output);
{Author: Anman}
{Purpose: Checks for Palindromes from an inputted string}
{Usage: FREE PUBLIC DOMAIN USE IS ALLOWED AS LONG AS DISTRIBUTORS KEEP THE AUTHOR, PURPOSE, AND USAGE COMMENTS AS SHOWN. USERS OF CODE MAY DELETE THESE :-).}

var palindrome:string;
i,x:integer;

procedure format(palindrome:string);

var i,j:integer;
forward2,reverse,holster:string;
pal:boolean;

begin
     reverse:=chr('O');
     forward2:=chr('O');
     pal:=false;
     for i:=1 to length(palindrome) do
          if (palindrome[i] <= 'z') and (palindrome[i] >= 'a') then palindrome[i] := (chr(ord(palindrome[i]) -32));
     for i:=1 to length(palindrome) do
          if (palindrome[i] <= 'Z') and (palindrome[i] >= 'A') then forward2:= concat(forward2, palindrome[i]);
     for i:=length(palindrome) downto 1 do
          if (palindrome[i] <= 'z') and (palindrome[i] >= 'a') then palindrome[i] := (chr(ord(palindrome[i]) -32));
     for i:=length(palindrome) downto 1 do
          if (palindrome[i] <= 'Z') and (palindrome[i] >= 'A') then reverse:= concat(reverse,palindrome[i]);
     writeln(forward2);
     writeln(reverse);
     if forward2 = reverse then
          writeln('This is a palindrome.');
else
     writeln('This is not a palindrome.');
end;

begin
     repeat
          write('What would you like to check for palindromeness (type quit to quit): ');
          readln(palindrome);
          format(palindrome);
     until palindrome='quit';
     page;
end.

 

Binary Central by Anman: "http://www15.brinkster.com/anman/"