Výmena riadkov a stĺpcov v matici
Delphi & Pascal (česká wiki)
Category: Homework in Pascal
Author: Pheo
web: pascalsource.ic.cz
Program: Dvojpole.pas
File exe: Dvojpole.exe
Author: Pheo
web: pascalsource.ic.cz
Program: Dvojpole.pas
File exe: Dvojpole.exe
Výmena riadkov a stĺpcov v matici.
{ DVOJPOLE.PAS Copyright (c) Pheo } { Výmena riadkov a stĺpcov v matici. } { } { Datum:26.04.2005 http://www.trsek.com } program dvojpole; uses crt; const n=5; type matica=array [1..n,1..n]of integer; var i,j,pom:integer; a:matica; begin clrscr; for i:=1 to n do for j:=1 to n do begin writeln ('zadaj prvok a[',i,';',j,']'); read (a[i,j]); end; clrscr; writeln('povodna matica:'); writeln; for i:=1 to n do begin for j:=1 to n do write (a[i,j],' '); writeln;writeln; end; writeln; for i:=1 to n do begin for j:=i+1 to n do begin pom:=a[i,j]; a[i,j]:=a[j,i]; a[j,i]:=pom; end; end; writeln('Otocena matica (vymenene riadky a stlpce)'); writeln; for i:=1 to n do begin for j:=1 to n do write (a[i,j],' '); writeln;writeln; end; repeat until keypressed; end.