Unit Vericard;


{$F+,D+,L+}



Interface


Function Vc(c : string) : char;


Implementation



  Function Vc(C : String) : Char;
  var
    card : string[21];
   Vcard : array[0..21] of byte absolute card;
   Xcard : Integer;
    Cstr : String[21];
     y,x : integer;


  Begin

   x:=0;

  Cstr:='                ';

  Cstr:='';

  Fillchar(Vcard,22,#0);

  Card:=C;

  for x:=1 to 20 do if Vcard[x] IN ([48..57]) then Cstr:=Cstr+chr(Vcard[x]);

  Card:='';

  Card:=Cstr;

    Xcard:=0;

     if NOT odd(length(card)) then

   for x:=length(card)-1 downto 1 do
  begin
  if odd(x) then y:=((Vcard[x]-48)*2) else y:=(Vcard[x]-48);
  if y>=10 then y:=((y-10)+1);
  Xcard:=(Xcard+y);
               end else for x:=length(card)-1 downto 1 do
           begin
  if odd(x) then y:=(Vcard[x]-48) else y:=((Vcard[x]-48)*2);
  if y>=10 then y:=((y-10)+1);
  Xcard:=(Xcard+y);
               end;

    x:=(10-(Xcard MOD 10));

    if (x=10) then x:=0;

  if x=(Vcard[length(card)]-48) then Vc:=Cstr[1] else Vc:=#0;

   end;

     end.





