Предмет:
Тип роботи:
Курсова робота
К-сть сторінок:
69
Мова:
Українська
13 01-1About.pdf
Опис програми
ДОДАТОК Б
ТЕКСТ ПРОГРАМИ
UA.ОМК.620111-05 12
//Основний код проекту
program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Form2},
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
Application.Run;
end.
//головниймодуль
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, StdCtrls, ExtCtrls, Buttons, Mask, Math, zoomingRN, XPMan,
ComCtrls,clipbrd;
type
TForm1 = class(TForm) //class(TMemo)
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
N9: TMenuItem;
Panel1: TPanel;
Panel2: TPanel;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
RadioButton4: TRadioButton;
RadioButton5: TRadioButton;
RadioButton6: TRadioButton;
RadioButton7: TRadioButton;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
SpeedButton5: TSpeedButton;
SpeedButton6: TSpeedButton;
SpeedButton7: TSpeedButton;
RadioButton10: TRadioButton;
RadioButton11: TRadioButton;
Inv: TCheckBox;
Hyp: TCheckBox;
Memo1: TMemo;
Panel3: TPanel;
XPManifest1: TXPManifest;
Panel4: TPanel;
Panel5: TPanel;
procedure FormCreate(Sender: TObject);
procedure RadioButton4Click(Sender: TObject);
procedure SpeedButton51Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure SpeedButton40Click(Sender: TObject);
procedure SpeedButton55Click(Sender: TObject);
procedure SpeedButton17Click(Sender: TObject);
procedure SpeedButton5Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton11Click(Sender: TObject);
procedure SpeedButton12Click(Sender: TObject);
procedure SpeedButton13Click(Sender: TObject);
procedure SpeedButton14Click(Sender: TObject);
procedure SpeedButton15Click(Sender: TObject);
procedure SpeedButton23Click(Sender: TObject);
procedure SpeedButton56Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure SpeedButton46Click(Sender: TObject);
procedure SpeedButton10Click(Sender: TObject);
procedure SpeedButton9Click(Sender: TObject);
procedure SpeedButton7Click(Sender: TObject);
procedure N8Click(Sender: TObject);
procedure N5Click(Sender: TObject);
private
{ Private declarations }
{ Public declarations }
end;
var
Form1: TForm1;
prover, glob_check,skob,nev,trig:boolean;
obrazec1,obrazec2:extended;
znac_oper:char;
obrazec12,zn1,zn2,zn: ZReal;
big: int64;
zt,zt1,zt2,pamet:string;
i,j,i_local,c,meraisch,t,sk: integer;
a:array [0..1000] of string;
b:array [0..1000] of char;
implementation
uses Unit2;
{$R *.dfm}
function zr_e (stroka: string): string;
var n:integer;
begin
zn:=strtozr(stroka);
zn2:=ZRToLongInt(zn,-1);
zn1:= subzr(zn,zn2);
if ( ComparisonZR(zn1,realtozr(0.0000001))=-1) then
begin
zn:= ZRToLongInt(zn,-1);
stroka:=zrtostr(zn);
end;
if ( ComparisonZR(zn1,realtozr(0.9999))=1) and ( ComparisonZR(zn1,realtozr(1))=-1) then
begin
zn:= ZRToLongInt(zn,1);
stroka:=zrtostr(zn);
end;
for n:=1 to length(stroka) do
if stroka[n]='+' then
begin
stroka[n-1]:='e';
delete(stroka,n,1);
end;
for n:=1 to length(stroka) do
if stroka[n]='-' then
begin
stroka[n-1]:='e';
end;
zr_e:=stroka;
end;
function Rezul2 (q:integer): string;
var d,n,z,r,p:integer;
begin
repeat
d:=0;
z:=0;
for i:=1 to q do
if b[i]='(' then d:=i;
for i:=d to q do
if b[i]=')' then
begin
z:=i;
break;
end;
b[d]:='0';
b[z]:='0';
if ((z<>0) and (d<>0)) then begin
for i:=d+1 to z-1 do
begin
if ((a[i]<>'|') and (b[i]='^')) then
begin
n:=i+1;
while (a[n]='|') do
begin
n:=n+1;
end;
zn1:=strtozr(a[i]);
zn2:=strtozr(a[n]);
zn2:=powerzr(zn1,zn2);
a[n]:=zr_e(zrtostr(zn2));
a[i]:='|';
end;
end;
for i:=d+1 to z-1 do
begin
if (a[i]<>'|') then
begin
case b[i] of
'*': begin
n:=i+1
while (a[n]='|') do
begin
n:=n+1;
end;
zn1:=strtozr(a[i]);
zn2:=strtozr(a[n]);
zn2:=multzr(zn1,zn2);
a[n]:=zr_e(zrtostr(zn2));
a[i]:='|';
end;
'l': begin
n:=i+1;
while (a[n]='|') do
begin
n:=n+1;
end;
zn1:=strtozr(a[n]);
zn1:=ZRToLongInt(zn1,-1);
zn2:=srtozr(a[i]);
zn2:=ZRToLongInt(zn2,-1);
zn:=inttozr(0);
while (ComparisonZR(zn,zn1)=(-1)){ or (ComparisonZR(zn,zn1)=0))} dо
begin
zn:=sumzr(zn,inttozr(1));
zn2:=multzr(zn2,inttozr(2));
end;
a[n]:=zr_e(zrtostr(zn2));
a[i]:='|';
end;
'h': begin
n:=i+1;
while (a[n]='|') do
begin
n:=n+1;
end;
zn1:=strtozr(a[n]);
zn1:=ZRToLongInt(zn1,-1);
zn2:=strtozr(a[i]);
zn2:=ZRToLongInt(zn2,-1);
zn:=inttozr(0);
while (ComparisonZR(zn,zn1)=(-1)){ or (ComparisonZR(zn,zn1)=0))} do
begin
zn:=sumzr(zn,inttozr(1));
zn2:=divzr(zn2,inttozr(2));
end;
a[n]:=zr_e(zrtostr(zn2));
a[i]:='|';
end;
'/': begin
n:=i+1;
while (a[n]='|') do
begin
n:=n+1;
end;
zn1:=strtozr(a[i]);
zn2:=strtozr(a[n]);
if (a[n]<>'0') then
begin
zn2:=divzr(zn1,zn2);
a[n]:=zr_e(zrtostr(zn2));
a[i]:='|';
end
else begin rezul2:='Делитьнанульнельзя'; exit; end;
end;
'm': begin
n:=i+1;
while (a[n]='|') do
begin
n:=n+1;
end;
zn1:=strtozr(a[i]);
zn2:=strtozr(a[n]);
if (a[n]<>'0') then
begin
zn1:=divzr(zn1,zn2);
zn:=ZRToLongInt(zn1,-1);
zn:=multzr(zn,zn2);
zn1:=strtozr(a[i]);
zn2:=subzr(zn1,zn);
a[n]:=zr_e(zrtostr(zn2));
a[i]:='|';
end
else begin rezul2:='Делитьнанульнельзя'; exit; end;
end;
'a': begin