There is a task:
In the rectangular matrix in each row, swap the first element of the line and the element containing the minimum number in the line.
Filling and output matrix, I did. Then I created another one-dimensional array into which I rewrote the strings.
Now I want to compare the elements of the lines between themselves. But something again went to the wrong steppe. How to make each line considered separately? I seem to be looking for the minimum value in the whole matrix ...
And even if I find the minimum value in each row, how to change the first element with the minimum in the line? Probably need some more variable ...
function min_v_strokah:integer; var i,j : integer; {peremennie dlya cikla} min : integer; {dlya poiska minimalnogo znacheniya} begin writeln; for i:=1 to a1 do begin for j:=1 to b1 do begin sravnenie[j]:=matr[i,j]; {perepisivaem stroki v massiv sravnenie[j]} if sravnenie[j] > matr[i,j] then begin matr[i,j] := min; end; end; writeln;writeln; end; end;
sravnenie[j]:=matr[i,j];
thesravnenie[j] > matr[i,j]
condition will always be false. - andrybak