Doučování Pascalu

Record

type student = record jmeno: string; prumer: real; end; studenti = array[1..3] of student; var i: byte; s: studenti; begin s[1].jmeno := 'Hana Švihálková'; s[1].prumer := 1; s[2].jmeno := 'Jan Kalab'; s[2].prumer := 2; s[3].jmeno := 'Pepek Zilvar z chudobince'; s[3].prumer := 5; for i := 1 to 3 do begin writeln('Jmeno: ', s[i].jmeno); writeln('Prumer:', s[i].prumer); end; end.

Matice

var m: array [1..3, 1..3] of byte; i, j: byte; begin {Inicializace matice} for i := 1 to 3 do for j := 1 to 3 do m[i][j] := 10 * i + j; {Zkusebni vypis matice} writeln('Matice:'); for i := 1 to 3 do begin for j := 1 to 3 do write(m[i][j], ' '); writeln(); end; writeln(); {Pruchod matici obracenou podle hlavni diagonaly} {Proste ve vypisu prohodime souradnice} writeln('Hlavni diagonala:'); for i := 1 to 3 do begin for j := 1 to 3 do write(m[j][i], ' '); writeln(); end; writeln(); {Pruchod matici obracenou podle vedlejsi diagonaly} {Ve vypisu opet prohodime souradnice, a navic downto} writeln('Vedlejsi diagonala:'); for i := 3 downto 1 do begin for j := 3 downto 1 do write(m[j][i], ' '); writeln(); end; end.