
Turbo Pascal z patchem,
Free Pascal IDE
i Dev-Pascal.
Za każdym razem jest jakiś błąd, chociaż ja nie mogę go dostrzec

A oto skrypt:
- Kod: Zaznacz wszystko
unit calc;
interface
uses crt,dos;
var
wynik:cardinal;
skl1,skl2,odj1,odj2,dzi1,dzi2,czy1,czy2:cardinal;
X,Y,PRZ:word;
procedure start;
procedure plus;
procedure minus;
procedure dziel;
procedure mnoz;
procedure blad;
procedure WriteXY(x,y:byte;t:string);
PROCEDURE RAMKA(x1,y1,x2,y2:byte);
procedure mycha;
procedure klik(var x,y,butt:word);
procedure przycisk;
procedure koniec;
procedure bladoff;
procedure wszystko;
implementation
procedure WriteXY(x,y:byte;t:string);
Begin
GotoXY(x,y);
Write(t);
End;
procedure ramka(x1,y1,x2,y2:byte);
Var
s:byte;
Begin
GotoXY(x1,y1);
Write(chr(201));
GotoXY(x1,y2);
Write(chr(200));
GotoXY(x2,y1);
Write(chr(187));
GotoXY(X2,X2);
Write(chr(188));
For s:=x1+1 To x2-1 Do WriteXY(s,y1,chr(205));
For s:=x1+1 To x2-1 Do WriteXY(s,y2,chr(205));
For s:=y1+1 To y2-1 Do WriteXY(x1,s,chr(186));
For s:=y1+1 To y2-1 Do WriteXY(x2,s,chr(186));
End;
procedure start;
Begin
mycha;
ramka(0,0,100,3);
ramka(1,5,8,7);
WriteXY(2,6,'Dodaj');
ramka(10,5,17,7);
WriteXY(11,6,'Odejmij');
ramka(1,19,8,21);
WriteXY(2,20,'Mnóż');
ramka(10,19,17,21);
WriteXY(11,20,'Dziel')
End;
procedure bladoff;
Begin
{$i-}
start
End;
procedure mycha;
var r:registers;
Begin
r.ax:=$0001;
Intr($33,r);
End;
procedure klik(var x,y,butt:word);
Var r:registers;
Begin
r.ax:=$0003;
Intr($33,r);
x:=r.cx;
y:=r.dx;
butt:=r.bx;
End;
procedure przycisk;
Begin
klik(x,y,prz);
if PRZ=1 then
Begin
if (x<8) and (x>1) and (y<7) and (y>5) then plus;
if (x<17) and (x>10) and (y<7) and (y>5) then minus;
if (x>1) and (x<8) and (y>19) and (y<21) then mnoz;
if (x>10) and (x<17) and (y>19) and (y<21) then dziel;
End;
End;
procedure dziel;
Begin
wynik:=0;
dzi1:=0;
dzi2:=0;
WriteXY(1,1,'Podaj dzielna! (enter=wyjscie z programu): ');
dzi1:=Read
if; (IoRESULT<>0) then blad;
else
if dzi1=chr(13) then koniec
else
ClrScr;
start;
WriteXY(1,1,'Podaj dzielnik! (enter=wyjscie z programu): ');
dzi2:=Read
if IoRESULT<>0 then blad
else
if dzi2=chr(13) then koniec else
ClrScr;
start;
wynik:=dzi1/dzi2;
if IoRESULT<>0 then blad
else WriteXY(1,1,dzi1, '/' ,dzi2, '=' ,wynik, '!');
RepeatUntil Keypressed;
ClrScr;
start;
End;
Procedure mnoz;
Begin
wynik:=' ';
czy1:=' ';
czy2:=' ';
WriteXY(1,1,'Podaj czynnik 1! (enter=wyjscie z programu): ');
czy1:=Read
if IoRESULT<>0 then blad else
if czy1=chr(13) then koniec else
ClrScr;
start;
WriteXY(1,1,'Podaj czynnik 2! (enter=wyjscie z programu): ');
czy2:=Read
if IoRESULT<>0 then blad else
if czy2=chr(13) then koniec else
ClrScr;
wynik:=czy1*czy2;
if IoRESULT<>0 then blad elsestart;
WriteXY(1,1,czy1, '*' ,czy2, '=' ,wynik, '!');
Repeat Until Keypressed;
ClrScr;
start;
End;
Procedure plus;
Begin
wynik:=' ';
skl1:=' ';
skl2:=' ';
WriteXY(1,1,'Podaj skladnik 1! (enter=wyjscie z programu): ');
skl1:=Read
if IoRESULT<>0 then blad else
if skl1=chr(13) then koniec else
ClrScr;
start;
WriteXY(1,1,'Podaj skladnik 2! (enter=wyjscie z programu): ');
skl2:=Read
if IoRESULT<>0 then blad else
if skl2=chr(13) then koniec else
ClrScr;
wynik:=skl1+skl2;
if IoRESULT<>0 then blad else
start;
WriteXY(1,1,skl1, '+' ,skl2, '=' ,wynik, '!');
Repeat Until Keypressed;
ClrScr;
start;
End;
Procedure minus;
Begin
wynik:=' ';
odj1:=' ';
odj2:=' ';
WriteXY(1,1,'Podaj odjemna! (enter=wyjscie z programu): ');
odj1:=Read
if IoRESULT<>0 then blad else
if odj1=chr(13) then koniec else
ClrScr;
start;
WriteXY(1,1,'Podaj odjemnik! (enter=wyjscie z programu): ');
odj2:=Read
if IoRESULT<>0 then blad else
if odj2=chr(13) then koniec else
ClrScr;
wynik:=odj1-odj2;
if IoRESULT<>0 then blad else
start;
WriteXY(1,1,odj1, '+' ,odj2, '=' ,wynik, '!');
Repeat Until Keypressed;
ClrScr;
start;
End;
procedure koniec;
{$i+}
procedure blad
Begin
ClrScr;
start;
WriteXY(1,1,'Wystapil nieoczekiwany blad!');
Repeat Until Keypressed;
ClrScr;
start;
WriteXY(1,1,'Wcisnij dowolny przycisk...')
Repeat Until Keypressed;
ClrScr;
start;
End;
procedure wszystko;
Begin
bladoff;
mycha;
klik;
start;
przycisk;
End;
begin
end.
Spoiler: