program fce_parametr_cli; {$mode objfpc}{$H+} uses Classes, SysUtils ,Math { you can add units after this }; type {funcionalni tadovy typ} Tgonfce = function(x:Extended):extended; {funkce maji stejnou hlavicku jako Tgonfce} function sinus(x:Extended):extended; begin result:=sin(x); end; function cosinus(x:Extended):extended; begin result:=cos(x); end; function tangent(x:Extended):extended; begin result:=tan(x); end; {v hlavice pouziji datovy typ Tgonfce} procedure GonioTable(start,step,stop:Extended;gonfce:Tgonfce); var finger:Extended; begin finger:=start; writeln('/-----------------------------\'); writeln('| x | f(x) |'); writeln('|--------------|--------------|'); while finger<=stop do begin {zde volam formalni funkci} writeln('| ',finger:10:3,' | ',gonfce(degtorad(finger)):10:3,' |'); finger += step; end; writeln('\-----------------------------/'); end; {$IFDEF WINDOWS}{$R fce_parametr_cli.rc}{$ENDIF} var fce:Tgonfce; begin {vytvorim nejprve odkaz na funkci} fce:=@sinus; GonioTable(0,5,30,fce); {nebo muzu rovnou puzit} GonioTable(0,5,30,@tangent); GonioTable(0,5,30,@cosinus); end.