Odpowiedzi

2010-01-13T16:46:43+01:00
Program calc;

uses crt;

var
a,b,c:real;
x:char;

label menu;

begin
menu:
clrscr;
writeln('Kalkulator');
writeln;
writeln('Co chcesz zrobic?:');
writeln;
writeln('1. Dodawac');
writeln('2. Ojejmowac');
writeln('3. Mnozyc');
writeln('4. Dzielic');
writeln;
writeln('k. Koniec');
x:=readkey;
clrscr;
case x of

'1':
begin
writeln('a+b=c');
writeln;
write('Podaj a: '); readln(a);
clrscr;
writeln(a,'+b=c');
writeln;
write('Podaj b: '); readln(b);
clrscr;
c:=a+b;
writeln(a,'+',b,'=',c);
readln;
end;

'2':
begin
writeln('a-b=c');
writeln;
write('Podaj a: '); readln(a);
clrscr;
writeln(a,'-b=c');
writeln;
write('Podaj b: '); readln(b);
clrscr;
c:=a-b;
writeln(a,'-',b,'=',c);
readln;
end;

'3':
begin
writeln('a*b=c');
writeln;
write('Podaj a: '); readln(a);
clrscr;
writeln(a,'*b=c');
writeln;
write('Podaj b: '); readln(b);
clrscr;
c:=a*b;
writeln(a,'*',b,'=',c);
readln;
end;

'4':
begin
writeln('a/b=c');
writeln;
write('Podaj a: '); readln(a);
clrscr;
writeln(a,'/b=c');
writeln;
repeat
write('Podaj b: '); readln(b);
until b<>0;
clrscr;
c:=a/b;
writeln(a,'/',b,'=',c);
readln;
end;

'k': halt;

end;
goto menu;
end.