document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. program SzamBetuvel;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses SysUtils;
  6.  
  7. const
  8.   Egyesek: array[0..9] of string = (\'\',\'egy\',\'kettő\',\'három\',\'négy\',\'öt\',\'hat\',\'hét\',\'nyolc\',\'kilenc\');
  9.   Tizesek: array[0..9] of string = (\'\',\'tíz\',\'húsz\',\'harminc\',\'negyven\',\'ötven\',\'hatvan\',\'hetven\',\'nyolcvan\',\'kilencven\');
  10.   Extra: array[0..2] of string = (\'\',\'tizen\',\'huszon\');
  11.  
  12. function szazas(szam:integer):string;
  13. var
  14.   tmp: string;
  15. begin
  16.   if szam>999 then
  17.   begin
  18.     Result:=\'#\';
  19.     exit;
  20.   end;
  21.   tmp:=\'\';
  22.   case Length(IntToStr(szam)) of
  23.     1: Result:=Egyesek[szam];
  24.     2: begin
  25.           if (((szam div 10)=1) or ((szam div 10)=2)) and (szam-((szam div 10)*10)<>0) then tmp:=Extra[szam div 10]
  26.           else tmp:=Tizesek[szam div 10];
  27.           Result:=tmp+Egyesek[szam-((szam div 10)*10)];
  28.        end;
  29.     3: begin
  30.          tmp:=Egyesek[szam div 100]+\'száz\';
  31.          if (((szam-((szam div 100)*100)) div 10) in [1,2]) and (((szam-((szam div 100)*100)) mod 10)>0) then tmp:=tmp+Extra[((szam-((szam div 100)*100)) div 10)]
  32.          else tmp:=tmp+Tizesek[((szam-((szam div 100)*100)) div 10)];
  33.          Result:=tmp+Egyesek[((szam-((szam div 100)*100)) mod 10)];
  34.        end;  
  35.   end;
  36. end;
  37.  
  38. function SzambolBetu(szam:longint): string;
  39. var
  40.   tmpstr: string=\'\';
  41.   tmpint: integer=0;
  42.   tmpszam: longint=0;
  43. begin
  44.   if szam=0 then
  45.   begin
  46.     Result:=\'nulla\';
  47.     exit;
  48.   end;  
  49.  
  50.   tmpszam:=szam;
  51.  
  52.   if Length(IntToStr(tmpszam))>9 then
  53.   begin
  54.     Result:=\'A szám túl nagy\';
  55.     exit;
  56.   end;
  57.  
  58.   tmpint:=tmpszam div 1000000;
  59.   if tmpint<>0 then
  60.   begin
  61.     tmpstr:=tmpstr+szazas(tmpint);  
  62.     if szam mod 1000000 > 0 then tmpstr:=tmpstr+\'millió - \'
  63.     else
  64.     begin
  65.       Result:=tmpstr+\'millió\';
  66.       exit;
  67.     end;
  68.   end;
  69.  
  70.   tmpszam:=tmpszam-(tmpint*1000000);
  71.   tmpint:=tmpszam div 1000;
  72.   if tmpint<>0 then
  73.   begin  
  74.     tmpstr:=tmpstr+szazas(tmpint);
  75.     if (szam > 2000) and (tmpszam mod 1000 <> 0) then tmpstr:=tmpstr+\'ezer - \'
  76.     else
  77.     begin
  78.       tmpstr:=tmpstr+\'ezer\';
  79.       if tmpszam mod 1000 = 0 then
  80.       begin
  81.         Result:=tmpstr;
  82.         exit;
  83.       end;  
  84.     end;
  85.   end;
  86.    
  87.   tmpszam:=tmpszam-(tmpint*1000);
  88.   tmpstr:=tmpstr+szazas(tmpszam);
  89.   Result:=tmpstr;
  90. end;
  91.  
  92. begin
  93.     writeln(SzambolBetu(1234553));
  94. end.
');