Портал освітньо-інформаційних послуг «Студентська консультація»

  
Телефон +3 8(066) 185-39-18
Телефон +3 8(093) 202-63-01
 (093) 202-63-01
 studscon@gmail.com
 facebook.com/studcons

<script>

  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)

  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

 

  ga('create', 'UA-53007750-1', 'auto');

  ga('send', 'pageview');

 

</script>

Інженерний калькулятор

Тип роботи: 
Курсова робота
К-сть сторінок: 
69
Мова: 
Українська
Оцінка: 

Classes, Graphics, Controls, Forms,

Dialogs, Buttons, StdCtrls, CheckLst;
type
TForm2 = class(TForm)
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
ListBox1: TListBox;
procedure SpeedButton1Click(Sender: TObject);
procedure Memo1KeyPress(Sender: TObject; var Key: Char);
procedure FormCreate(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
private
{ Private declarations }
Public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
uses Unit1;
{$R *.dfm}
procedure TForm2.SpeedButton1Click(Sender: TObject);
begin
form1.SetFocus;
end;
procedure TForm2.Memo1KeyPress(Sender: TObject; var Key: Char);
begin
key:=chr(0);
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
form1.speedbutton52.Visible:=true;
form1.speedbutton53.Visible:=true;
form1.speedbutton54.Visible:=true;
form1.speedbutton55.Visible:=true;
end;
procedure TForm2.FormActivate(Sender: TObject);
begin
form1.speedbutton52.Enabled:=true;
form1.speedbutton53.Enabled:=true;
form1.speedbutton54.Enabled:=true;
form1.speedbutton55.Enabled:=true;
end;
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
form1.speedbutton52.Enabled:=false;
form1.speedbutton53.Enabled:=false;
form1.speedbutton54.Enabled:=false;
form1.speedbutton55.Enabled:=false;
end;
procedure TForm2.SpeedButton3Click(Sender: TObject);
begin
ListBox1.Items.Delete(ListBox1.ItemIndex);
end;
procedure TForm2.SpeedButton4Click(Sender: TObject);
begin
ListBox1.Items.Clear;
end;
procedure TForm2.SpeedButton2Click(Sender: TObject);
begin
if (ListBox1.ItemIndex=-1) then ShowMessage('Нет чисел для добавления')
else
form1.Memo1.Text:=ListBox1.Items.Strings[ListBox1.ItemIndex];
glob_check:=true;
end;
end.
 
//Операції з мульти розрядними дійсними числами типу Real
unit zoomingRN;
interface
type
TZN =  array of Byte;  
ZReal =  Record  
R :Byte; {arithmetic range: binary(=2), decimal(=10), hexadecimal(=16), and others}
E :Int64; {number exponent (index of power)}
U :Char; {Unary}
I :TZN; {Number - array of digits}
end;
type
TDynArrZR =  array of ZReal;   
var
ShowErrorZR: boolean = false;
ErrorZR: boolean = false;
MessageZR: string = '';
MaxZNCount: Cardinal = 32;
InfZNCount: Cardinal = 1000;
ZeroZNExp:Int64 = low(Int64);
RoundZN:Byte = 5;
RealTypeShow:Boolean = False;
const
VersionZR='1.0 Original for Delphi [Byte]';
setNumsZR = ['0'..'9'] ; 
setUnarZR = ['+', '-'] ; 
setCharZR = ['z', 'Z'] ;
setCharIR = ['i', 'I'] ;
setCharPo = ['.', ','] ;    
setCharER = ['e', 'E', 'е', 'Е'] ; 
decimal=10; 
MaxZNCountDefault=32;
function InfiniteZR(Un: Char): ZReal;
function HighDeciZR(const ZR: ZReal;  out IsNearInf: Boolean): ZReal;
function Pi_ZR: ZReal;
function e_ZR: ZReal;
function IsInfinite(const ZR: ZReal): Boolean;
function TanhZR(const ZR: ZReal ): ZReal;
function CothZR(const ZR: ZReal ): ZReal;
function PowerZR(const ZR: ZReal; Power: ZReal): ZReal;
function Log2ZR(const ZR: ZReal): ZReal;
function Log10ZR(const ZR: ZReal): ZReal;
function LogNZR(const Base, ZR: ZReal): ZReal;
function CotanZR(const ZR: ZReal ): ZReal;
function CosZR(const ZR: ZReal ): ZReal;
function SinZR(const ZR: ZReal ): ZReal;
procedure SinCosZR(const Theta: ZReal; out Sin, Cos: ZReal);
implementation
uses
Windows,
SysUtils;
Type
TMathValueSign = -1..1;
const
MathNegativeValue = Low(TMathValueSign);
MathZeroValue = 0;
MathPositiveValue = High(TMathValueSign);
function MathRandomRange(const AFrom, ATo: Integer): Integer;
begin
if AFrom > ATo then
Result := Random(AFrom - ATo) + ATo
Else
Result := Random(ATo - AFrom) + AFrom;
end;
function IsIn9_10(const ZR: ZReal): Boolean;
varlen:Integer;
begin
Result:=False;
len:=Length(ZR.I);
if len=0 then Exit;
if len=1 then
begin
if ZR.I[0]=9 then Result:=True;
Exit;
end;
if ZR.I[High(ZR.I)]=9 then begin Result:=True; Exit; end;
if (ZR.I[High(ZR.I)]=1) and (ZR.I[High(ZR.I)-1]=0) then Result:=True;
end;
function IsIn999_1000(const ZR: ZReal): Boolean;
varlen,k:Integer;
begin
Result:=False;
len:=Length(ZR.I);
if len<3 then Exit;
if len=3 then
begin
if (ZR.I[0]=ZR.I[2]) and (ZR.I[0]=ZR.I[1]) and (ZR.I[0]=9) then Result:=True;
Exit;
end;
k:=High(ZR.I);
if (ZR.I[k-2]=9) and (ZR.I[k-1]=9) and (ZR.I[k]=9) then
begin Result:=True; Exit; end;
if (ZR.I[k]=1) and (ZR.I[k-1]=0) and (ZR.I[k-2]=0) and (ZR.I[k-3]=0) then Result:=True;
end;
function IsIn99999_100000(const ZR: ZReal): Boolean;
var len,k,i:Integer;
begin
Result:=False;
len:=Length(ZR.I);
if len<4 then Exit;
if len=4 then
begin
for i:=0 to len-1 do
if (ZR.I[i]<>9) then Exit;
Result:=True;
Exit;
end;
k:=High(ZR.I);
if ZR.I[k]=9 then
begin
for i:=1 to 4 do
begin
if ZR.I[k-i]<>9 then Exit;
end;
Result:=True;
Exit;
end;
if ZR.I[k]=1 then
begin
for i:=1 to 5 do
begin
if ZR.I[k-i]<>0 then Exit;
end;
Result:=True;
Exit;
end;
end;
procedure DelArrElem(var A: TDynArrZR; Index: Integer);
var
n: Integer;
i: Integer;
begin
n:= High(A);
if Index<n then
begin
for i:=Index to n-1 do
begin
A[i]:=A[i+1];
end;
SetLength(A, n-1 );
end;
end;
function squeezeArea(const ZR: ZReal): ZReal;
var
ZR0: ZReal;
BakMaxZNCount:Cardinal;
exp: Int64;
bool: Boolean;
begin
Result:=ZR;
BakMaxZNCount:=MaxZNCount;
exp:=HighDeciZR(ZR,bool).E;
if exp>1000 then exp:=1000;
if exp>0
then MaxZNCount:=MaxZNCount+exp+2      
else MaxZNCount:=MaxZNCount+2;
while MoreThanZR(AbsZR(Result),Pi_ZR) do
begin
ZR0:=DivZR(Result,PiMult2_ZR);
ZR0:=ZRToLongInt(ZR0);
ZR0:=MultZR(PiMult2_ZR,ZR0);
Result:=SubZR(Result,ZR0);
end;
MaxZNCount:=BakMaxZNCount;
end;
function _CosZR(const ZR: ZReal): ZReal;
var
ZR0,ZR1,ZR2,ZR3,ZR4: ZReal;
BakMaxZNCount: Cardinal;
bool: Boolean;
i,j: Integer;
iExp: Integer;
begin
BakMaxZNCount:=MaxZNCount;
MaxZNCount:=MaxZNCount+3;
ZR0:=OneZR;                  
ZR4:=SqrZR(ZR);
ZR1:=ZR0;
j:=HighDeciZR(ZR0,bool).E; 
iExp:=j-MaxZNCount+2;
i:=0; 
ZR2:=OneZR;
while (j>iExp) do
begin
MaxZNCount:=j-iExp+2; 
ZR1:=MultZR(ZR4,InvertUnaryZR(ZR1)); 
Inc(i);
ZR2:=MultZR(ZR2,IntToZR(i));
Inc(i);
ZR2:=MultZR(ZR2,IntToZR(i)); 
ZR3:=DivZR(ZR1,ZR2);
j:=HighDeciZR(ZR3,bool).E;   
MaxZNCount:=BakMaxZNCount+2;
ZR0:=SumZR(ZR0,ZR3);
end;
Result:=ZR0;
MaxZNCount:=BakMaxZNCount;
end;
j:=HighDeciZR(ZR0,bool).E; 
iExp:=j-MaxZNCount+2; 
i:=1; 
ZR2:=OneZR;
while (j>iExp) do
begin
MaxZNCount:=j-iExp+2; 
ZR1:=MultZR(ZR4,InvertUnaryZR(ZR1));  
Inc(i);
ZR2:=MultZR(ZR2,IntToZR(i));
Inc(i);
ZR2:=MultZR(ZR2,IntToZR(i)); 
ZR3:=DivZR(ZR1,ZR2);
j:=HighDeciZR(ZR3,bool).E;   
MaxZNCount:=BakMaxZNCount+2;
ZR0:=SumZR(ZR0,ZR3);
end;
Result:=ZR0;
MaxZNCount:=BakMaxZNCount;
end;
procedure Func(Const arg: ZReal; out F: ZReal; Const Ind: ShortInt);
begin
case ind of
-1: F:=_CosZR(arg);
1: F:=_SinZR(arg);
end; 
end;
function TrimLeftZR(var Arr:TZN): Boolean;
i:Integer; 
lenN: Integer; 
nzero:Integer; 
begin
Result:=False;
lenN:=Length(Arr);
nzero:=0;
for i:=lenN-1 downto 0 do
begin
if Arr[i] = 0 then  Inc(nzero)
else Break; 
end;
if nzero > 0 then
begin
if lenN=nzero then Dec(nzero);
SetLength(Arr, lenN-nzero);
if lenN>1 then Result:=True;
end;
end;
function TrimRightZR(var ZR:ZReal): Shortint;
var
i:Integer; 
lenN: Integer; 
nzero:Integer; 
begin
Result:=0;
lenN:=Length(ZR.I);
nzero:=0;
for i:=0 to lenN-1  do
begin
if ZR.I[i] = 0 then  Inc(nzero)
else Break; 
end;
if nzero=lenN then begin Result:=1; ZR:=DefaultZR; 
Exit; 
end;   
if nzero > 0 then
begin
if ZR.E>0 then
if (High(Int64)-ZR.E)<nzero then begin Result:=-1; Exit; end;
for i:=0 to lenN-nzero-1 do
begin
ZR.I[i] := ZR.I[i+nzero]; 
end;
SetLength(ZR.I, lenN-nzero);
ZR.E:=ZR.E+nzero;
Result:=1;
end;
end;
function LengthZR(var ZR:ZReal): Cardinal;   
var
rExp:Int64;
isInf:Boolean;
begin
Result:=0;
if ZR.U='-' then Inc(Result);
if RealTypeShow then
begin
rExp:=HighDeciZR(ZR,isInf).E;
if not isInf then
begin
Result:=Length(ZRToStr(ZR));      
Exit;
end;
end;
if ZR.E<>0 then
begin
Result:=Result+Length(IntToStr(ZR.E))+1;
if ZR.E>0 then Result:=Result+1;
end;
Result:=Result+Length(ZR.I);
end;
function RefreshZR(var ZR:ZReal): ZReal;
begin
TrimLeftZR(ZR.I);
TrimRightZR(ZR);
Result:=ZR;
end;
function AbsZR(const ZR: ZReal): ZReal;
begin
Result:=ZR;
if Result.U='-' then begin Result.U:='+'; Exit; end;
if Result.U='i' then begin Result.U:='I'; Exit; end;
end;
function EpsilonZR: ZReal;
var
zArr:TZN;
begin
Result.E:=ZeroZNExp;
Result.U:='+';
Result.R:=decimal;
SetLength(zArr, 1);  
zArr[0]:=1;
Result.I:=zArr;
end;
function OneDivZR(const ZR: ZReal): ZReal;
begin
Result:=DivZR(OneZR, ZR);
end;
function PercentZR(const Percent: ZReal; const ZR: ZReal): ZReal;
begin
Result:=DivZR(Percent, StrToZR('100'));
Result:=MultZR(Result,ZR);
end;
function MinExtendedZR: ZReal; 
begin
Result.R:=decimal;
Result.E:=-4933;
Result.U:='+';
SetLength(Result.I, 2);  
Result.I[0]:=4;
Result.I[1]:=3;
end;
function EqvToZR(const WhatZR: ZReal; const ToZR: ZReal): Boolean;
begin
Result := ComparisonZR(WhatZR, ToZR) = 0 ;
End.
Фото Капча