Добавил:
TheBazilius
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:1 семестр сессия / 17
.pas Program Lab_426_Var17;
Type Massive = Array [1..5,1..5] Of Integer;
Procedure Zamena(Var A:Massive; J1,J2,M,N:Integer);
Var
X,I,J:Integer;
Begin
For I:=1 To M Do
Begin
For J:=1 To N Do
If (J=J1) Then
Begin
X:=A[I,J1];
A[I,J1]:=A[I,J2];
A[I,J2]:=X;
Write(A[I,J1],' ');
End
Else Write(A[I,J],' ');
Writeln;
End;
End;
Var
J1,J2,I,J,M,N:Integer;
A,B:Massive;
Begin
Randomize;
Writeln('1 : ');
For I:=1 To 5 Do
Begin
For J:=1 To 4 Do
Begin
A[I,J]:=Random(21) - 10;
Write(A[I,J],' ');
End;
Writeln;
End;
Writeln('2 : ');
For I:=1 To 4 Do
Begin
For J:=1 To 3 Do
Begin
B[I,J]:=Random(21) - 10;
Write(B[I,J],' ');
End;
Writeln;
End;
Writeln; Writeln; Writeln;
M:=5; N:=4; J1:=2; J2:=4; Zamena(A,J1,J2,M,N);
Writeln;
M:=4; N:=3; J1:=2; J2:=3; Zamena(B,J1,J2,M,N);
End.
Type Massive = Array [1..5,1..5] Of Integer;
Procedure Zamena(Var A:Massive; J1,J2,M,N:Integer);
Var
X,I,J:Integer;
Begin
For I:=1 To M Do
Begin
For J:=1 To N Do
If (J=J1) Then
Begin
X:=A[I,J1];
A[I,J1]:=A[I,J2];
A[I,J2]:=X;
Write(A[I,J1],' ');
End
Else Write(A[I,J],' ');
Writeln;
End;
End;
Var
J1,J2,I,J,M,N:Integer;
A,B:Massive;
Begin
Randomize;
Writeln('1 : ');
For I:=1 To 5 Do
Begin
For J:=1 To 4 Do
Begin
A[I,J]:=Random(21) - 10;
Write(A[I,J],' ');
End;
Writeln;
End;
Writeln('2 : ');
For I:=1 To 4 Do
Begin
For J:=1 To 3 Do
Begin
B[I,J]:=Random(21) - 10;
Write(B[I,J],' ');
End;
Writeln;
End;
Writeln; Writeln; Writeln;
M:=5; N:=4; J1:=2; J2:=4; Zamena(A,J1,J2,M,N);
Writeln;
M:=4; N:=3; J1:=2; J2:=3; Zamena(B,J1,J2,M,N);
End.
Соседние файлы в папке 1 семестр сессия