Make the program for switches array A to B when A(1) switch toB(n), A2 switch toB(n-1)
Delphi & Pascal (česká wiki)
Category: Homework in Pascal
Program: Polecopy.pas
File exe: Polecopy.exe
flow: Polecopy.gif
Program: Polecopy.pas
File exe: Polecopy.exe
flow: Polecopy.gif
Make the program for switches array A to B when A(1) switch toB(n), A2 switch toB(n-1).
{ POLECOPY.PAS Copyright (c) TrSek alias Zdeno Sekerak } { Vypracujte program pre prekopirovanie pola A do B v obratenom poradi } { A(1) do B(n), A2 do B(n-1) } { } { Datum:04.02.2004 http://www.trsek.com } program pole_naopak; uses crt; var a:array[1..100] of real; b:array[1..100] of real; i:integer; n:integer; begin ClrScr; WriteLn('Program prekopiruje pole A do B v opacnom poradi.'); Write('Zadaj pocet poloziek pola A:'); ReadLn(n); { nacita az pole } for i:=1 to n do begin Write('Zadaj a[',i,']='); ReadLn(a[i]); end; { otocenie pola A do B } for i:=1 to n do b[n-i+1] := a[i]; WriteLn; WriteLn('Otocene pole B je'); WriteLn; WriteLn('Por| A | B |'); WriteLn('----------------------'); { vypise pole A aj obratene pole B } for i:=1 to n do WriteLn( i:3,'|', a[i]:8:3, '|', b[i]:8:3, '|' ); WriteLn('----------------------'); ReadLn; end.