Контрольная «Решение задач» по Программированию (Попов Д. И.)

Кирилл Николоев сб, 16.04.2016 14:56

1 program lab10; {$APPTYPE CONSOLE} uses SysUtils; var arr1:array of integer; i,n:integer; procedure rand; var i,r:integer; begin randomize; setlength(arr1,n); for i:=1 to n do begin r:=random(1000+1000+1)-1000;

arr1[i]:=r; end; end; procedure bubble(var arr1:array of integer); var i,j,t:integer; begin for i:=1 to n do begin for j:=n downto i+1 do if(arr1[j-1]>arr1[j]) then begin t:=arr1[j-1]; arr1[j-1]:=arr1[j];

arr1[j]:=t; end; end; end; begin n:=5000; rand; bubble(arr1); readln; end. 2 program lab1_2; var a,b,c:integer; begin readln(a,b,c); if (a=2) or (a=5) then writeln('4islo A= ',a,' na granice intervala [25]')

else if (a>2) and (a2) and (b2) and (cy) then writeln('4islo X= ',x:8:2,' > 4isla Y= ',y:8:2) else if (x>'); writeln; for I:=0 to cN-1 do write(aB[i],' | '); readln; readln;

end. 12 program lab3_3; var a:array [0100,0100] of real; amin,amax:array [01] of integer; min,max:real; i,j,n:integer; begin readln(n); writeln(‘Fill the matrix >>>'); for i:=0 to n-1 do for j:=0 to n-1 do

begin writeln('Put meanings ',i+1,' ',j+1,' of the matrix'); readln(a[i,j]); end; min:=a[0,0]; max:=a[0,0]; for i:=0 to n-1 do for j:=0 to n-1 do begin if min>a[i,j] then begin

min:=a[i,j]; amin[0]:=i; amin[1]:=j; end; if a[i,j]>max then begin max:=a[i,j]; amax[0]:=i; amax[1]:=j; end; end; writeln(''); for i:=0 to n-1 do begin for j:=0 to n-1 do begin write(a[i,j]:5:2,' | ');

end; writeln; end; writeln('The biggest meaning is',max:5:2,' s koord - ',amax[0]+1,'*',amax[1]+1); writeln('The smallest meaning is',min:5:2,' s koord - ',amin[0]+1,'*',amin[1]+1);

Скачать файлы

Похожие документы