Figury

Wersja 1.

program figury;
uses crt;
var w, k: integer; {wiersze i kolumny}
    f: char;       {wybrana figura}
    i, j: integer; {iteracje}

begin
        clrscr;
        repeat begin
                WriteLn('Wybierz figure: ');
                WriteLn('P: prostokat');
                WriteLn('T: trojkat');
                Write('C: choinka ');
                f:=readkey;
                WriteLn;
                end
        until (f='P') or (f='T') or (f='C');
        Write('Podaj liczbe wierszy: ');
        ReadLn(w);
        clrscr;

        if(f='P') then begin
                Write('Podaj liczbe kolumn: ');
                ReadLn(k);
                clrscr;
                for i:=1 to w do begin
                        for j:=1 to k do Write('*');
                        WriteLn;
                end;
        end;

        if(f='T') then begin
                for i:=1 to w do begin
                        for j:=1 to i do Write('*');
                        WriteLn;
                end;
        end;

        if(f='C') then begin
                for i:=1 to w do begin
                        for j:=w-i downto 1 do Write(' ');
                        for j:=1 to 2*i-1 do write('*');
                        writeln;
                end;
        end;
delay(2000);
end.

Czytaj dalej