Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program pola_i_objetosci;
- uses
- crt;
- const
- PI = 3.14;
- var
- C : Char;
- r, h, a, Pole : Real;
- procedure Kolo;
- begin
- ClrScr;
- Write('Podaj dlugosc promienia: ');
- Readln(r);
- Pole := PI * r * r;
- Writeln('Pole = ', Pole : 0 : 2);
- end;
- procedure Trojkat;
- begin
- ClrScr;
- Write('Podaj wysokosc trojkata: ');
- Readln(h);
- Write('Podaj dlugosc podstawy: ');
- Readln(a);
- Pole := 0.5 * h * a;
- Writeln('Pole = ', Pole : 0 : 2);
- end;
- procedure Kwadrat;
- begin
- ClrScr;
- Write('Podaj dlugosc boku: ');
- Readln(a);
- Pole := a * a;
- Writeln('Pole = ', Pole : 0 : 2);
- end;
- begin
- repeat
- ClrScr;
- Writeln('Pole jakiej figury chcesz policzyc?');
- Writeln('1. Kolo');
- Writeln('2. Trojkat');
- Writeln('3. Kwadrat');
- Writeln;
- Writeln('4. Wyjscie');
- Writeln;
- Writeln('Aby dokonac wyboru nacisnij cyfre od 1 do 4.');
- C := ReadKey;
- until C in ['1'..'4'];
- case C of
- '1' : Kolo;
- '2' : Trojkat;
- '3' : Kwadrat;
- '4' : Exit;
- end;
- Writeln('Nacisnij dowolny klawisz.');
- repeat
- until KeyPressed;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement