|
zadach162.BAS |
|
{* Задача162 *}REM basic ' Дан массив. Поменять местами элементы строки 2-й и элемента a-34CLS
m = 10
n = 10
INPUT "Vvedite kol-vo stolbcov:"; m
INPUT "Vvedite kol-vo strok:"; n
Dim A(m, n) As Integer
RANDOMIZE TIMER
For iy = 1 To n: For ix = 1 To m
A(ix, iy) = RND * 50: PRINT A(ix, iy);
Next: PRINT : Next
For iy = 1 To n: For ix = 1 To m
If A(ix, iy) = 34 Then
PRINT "Stroka s elementom = 34 naidena"
PRINT "Menyaem stroki 2 i"; iy
For j = 1 To m
SWAP A(j, iy), A(j, 2)
Next
For iy2 = 1 To n: For ix2 = 1 To m
If iy2 = 2 Or iy2 = iy Then COLOR 10 Else COLOR 7
PRINT A(ix2, iy2);
Next: PRINT : Next
End
End If
Next: Next
PRINT "Stroka s elementom = 34 ne naidena!"
End
|