CLS
RANDOMIZE TIMER
n = 5
DIM c(n, n), z(n, n)
FOR i = 1 TO n
FOR j = 1 TO n
c(i, j) = FIX(RND * 20) - 10
NEXT
NEXT
FOR i = 1 TO n
FOR j = 1 TO n
IF c(i, j) > 0 THEN z(i, j) = c(i, j) ELSE z(i, j) = 0
NEXT
NEXT
OPEN "data.dat" FOR OUTPUT AS #1
PRINT #1, "massiv c"
FOR i = 1 TO n
FOR j = 1 TO n
PRINT #1, c(i, j);
NEXT
PRINT #1,
NEXT
PRINT #1, "massiv z"
FOR i = 1 TO n
FOR j = 1 TO n
PRINT #1, z(i, j);
NEXT
PRINT #1,
NEXT
CLOSE #1
Тестирование выполнено в программе QB64 ( Скачать )