Вывести массив и поменять местами 1й и 3й столбец — QBasic(Бейсик)

массив
2 2 2 2
0 1 0 2
0 0 1 3
2 0 3 0
DIM a(4, 4)
DATA 2,2,2,2,0,1,0,2,0,0,1,3,2,0,3,0
FOR i = 1 TO 4
    FOR j = 1 TO 4
        READ a(i, j)
    NEXT
NEXT
PRINT "ishodnyj massiv"
FOR i = 1 TO 4
    FOR j = 1 TO 4
        PRINT a(i, j); " ";
    NEXT
    PRINT
NEXT
FOR i = 1 TO 4
    SWAP a(i, 1), a(i, 3)
NEXT
PRINT "novyj massiv"
FOR i = 1 TO 4
    FOR j = 1 TO 4
        PRINT a(i, j); " ";
    NEXT
    PRINT
NEXT

Тестирование выполнено в программе QB64 ( Скачать )

Leave a Comment