Sub ()dim a(1 to 4, 1 to 4) as integerdim b(1 to 3, 1 to 3) as integerrandomizefor i = 1 to 4 for j = 1 to 4 a(i, j) = int((10 * rnd) + 1) cells(i, j) = a(i, j) next jnext ifor i = 1 to 3 for j = 1 to 3 b(i, j) = int((10 * rnd) + 1) cells(i + 5, j) = b(i, j) next jnext icall obrabotkaa(a)call obrabotkab(b)call result(a, b)end subsub obrabotkaa(a)collumnmax = 0collumnmin = 0summmax = 0summmin = 999for j = 1 to 4summ = 0 for i = 1 to 4 summ = summ + a(i, j) next i if summ > summmax then summmax = summ collumnmax = j end if if summ < summmin then summmin = summ collumnmin = j end ifnext jfor i = 1 to 4 temp = a(i, collumnmax) a(i, collumnmax) = a(i, collumnmin) a(i, collumnmin) = tempnext iend subsub obrabotkab(b)collumnmax = 0collumnmin = 0summmax = 0summmin = 999for j = 1 to 3summ = 0 for i = 1 to 3 summ = summ + b(i, j) next i if summ > summmax then summmax = summ collumnmax = j end if if summ < summmin then summmin = summ collumnmin = j end ifnext jfor i = 1 to 3 temp = b(i, collumnmax) b(i, collumnmax) = b(i, collumnmin) b(i, collumnmin) = tempnext iend subsub result(a, b)for i = 1 to 4 for j = 1 to 4 cells(i, j + 5) = a(i, j) next jnext ifor i = 1 to 3 for j = 1 to 3 cells(i + 5, j + 5) = b(i, j) next jnext iend sub
Спасибо
Популярные вопросы