Модуль Function
unit Functions;
{$F+} {$N+}Graph,GrOutPut;SetEnterMode (Func: char);GetResult;FilterExpValue (var Par: StrParam);IntToStr (Param: word): String;: string;: word;(Param,Temp);: =Temp;;FilterExpValue (var Par: StrParam);degree,mant,NullStr: string;,e,DotPos,ExpPos: integer;,minus: boolean;: integer;Par [1] ='-' then minus: =trueminus: =false;: =Pos ('. ',Par);: =Pos ('E',Par);: ='';: ='';: =false;
{**************}ExpPos=0 then exit;: =Copy (Par,ExpPos+1,Length (Par) - ExpPos);: =Copy (Par,DotPos-1,ExpPos-DotPos+1);(Degree, IntDegree,e);(IntDegree>0)begini: =1 to IntDegreebegin: =Pos ('. ',mant);(mant,DotPos,1);('. ',mant,DotPos+1);;;(IntDegree<0)begini: =1 to - IntDegreebegin('0',mant,1);: =Pos ('. ',mant);(mant,DotPos,1);('. ',mant,2);;;: =Length (mant);(mant [i] ='0')begin(mant, i,1);: =i-1;;mant [Length (mant)] ='. 'Delete (mant,Length (mant),1);minus then insert ('-',mant,1);: =mant;;ExcludeMines (Par: boolean);Par thenPos ('-',FParam) <>0 then(FParam,1,1);Pos ('-',SParam) <>0 then(SParam,1,1);elsePos ('-',FParam) =0 then: ='-'+FParam;Pos ('-',SParam) =0 then: ='-'+SParam;;;Value (FPar,SPar: StrParam; var FTemp,STemp);: word;(FPar,Extended (FTemp),e);(SPar,Extended (STemp),e);;Operation: string;,STemp,Res: extended;,Answer: StrParam;,RetBin,Ex: boolean;: word;
{******************}
{******************}: =false;: =false;(FParam,SParam,FTemp,STemp);: =false; {*used for exit after odnomest function*}CurrentFunc of
'+': Res: =FTemp+STemp;
'-': Res: =FTemp-STemp;
'*': Res: =FTemp*STemp;
'/': if SParam<>'0'then Res: =FTemp/STemp;
's': Res: =sin (ftemp);
'c': Res: =cos (ftemp);
't': Res: = (sin (ftemp) /cos (ftemp));
'k': Res: = (cos (ftemp) /sin (ftemp));
'√': Res: =sqrt (Ftemp);
'x': Res: =exp (ln (Ftemp) *stemp);;(Res,St);Ex then exit;(st);(SParam);(FParam);: =St;: =st;: =#0;(Result);;;SetEnterMode (Func: char);(Func in AllOper) then(Length (FParam) =0) or (FParam='0') then(true);elseFunc in ['n','p'] then: =Func;;;;(False);CurrentFunc=#0 then: =Func;;Calculated then: =Operation;;Calculated then: =Result;;(true);(FParam);(false);: =false;: ='';: ='';else(Length (SParam) >0) and (SParam<>'0') then(FParam);(SParam);: =Operation;;;;;GetResult;not Calculated thenCurrentFunc<>#0 then: =Operation;;.
Достарыңызбен бөлісу: |