Program 4 działania
PROGRAM cztery_dzialania;
USES Crt;
VAR Liczba1, Liczba2, Wynik: Real;
Operator,Przycisk: Char;
BEGIN
Repeat
ClrScr;Wynik:=0;
GotoXY(20,6); Write('Cztery dzialania');
GotoXY(20,10); Write ('Podaj x: ');Readln (Liczba1);
GotoXY(20,12); Write ('Podaj y: ');Readln (Liczba2);
GotoXY(20,14); Write ('Wybierz operator (+, -, *, /) : ');Readln (Operator);
While (Operator = '/') And (Liczba2 = 0) Do
Begin
GotoXY(20,16); Write ('Podaj y <> 0: ');Readln (Liczba2);
End;
Case Operator of
'+' : Wynik := Liczba1 + Liczba2;
'-' : Wynik := Liczba1 - Liczba2;
'*' : Wynik := Liczba1 * Liczba2;
'/' : Wynik := Liczba1 / Liczba2;
End;
GotoXY(20,18);Write(Liczba1:4:2, Operator, Liczba2:4:2, '=', Wynik:4:2);
GotoXY(20,23); Write('Esc - koniec Enter - kontynuacja');
Przycisk:=readkey;
until Przycisk=#27;
END.