Sub main
dim n as long,counter as long
for n=0 to 10
counter=counter+GetRowA(n)
next
for n=0 to 12
counter=counter+GetRowB(n)
next
MsgBox "Строк: " & counter
counter=0
for n=0 to 10
counter=counter+GetColumnA(n)
next
for n=0 to 12
counter=counter+GetColumnB(n)
next
MsgBox "Столбцов: " & counter
End sub
function GetRowA(RNumber) as long
dim x as long, retval as long
retval=1
for x=0 to 5
if A(x,RNumber)<0 then retval=0
next
GetRowA=retval
end function
function GetRowB(RNumber) as long
dim x as long, retval as long
retval=1
for x=0 to 15
if A(x,RNumber)<0 then retval=0
next
GetRowB=retval
end function
function GetColumnA(CNumber) as long
dim y as long, retval as long
retval=1
for y=0 to 10
if A(CNumber,y)<0 then retval=0
next
GetColumnA=retval
end function
function GetColumnB(CNumber) as long
dim y as long, retval as long
retval=1
for y=0 to 12
if A(CNumber,y)<0 then retval=0
next
GetColumnB=retval
end function
Option Explicit
Dim A(5, 10) As Long, B(15, 12) As Long
Sub main()
Dim n As Long, counter As Long
For n = 0 To 10
counter = counter + GetRowA(n)
Next
For n = 0 To 12
counter = counter + GetRowB(n)
Next
MsgBox "Строк: " & counter
counter = 0
For n = 0 To 5
counter = counter + GetColumnA(n)
Next
For n = 0 To 15
counter = counter + GetColumnB(n)
Next
MsgBox "Столбцов: " & counter
End Sub
Function GetRowA(RNumber) As Long
Dim x As Long, retval As Long
retval = 1
For x = 0 To 5
If A(x, RNumber) < 0 Then retval = 0
Next
GetRowA = retval
End Function
Function GetRowB(RNumber) As Long
Dim x As Long, retval As Long
retval = 1
For x = 0 To 15
If B(x, RNumber) < 0 Then retval = 0
Next
GetRowB = retval
End Function
Function GetColumnA(CNumber) As Long
Dim y As Long, retval As Long
retval = 1
For y = 0 To 10
If A(CNumber, y) < 0 Then retval = 0
Next
GetColumnA = retval
End Function
Function GetColumnB(CNumber) As Long
Dim y As Long, retval As Long
retval = 1
For y = 0 To 12
If B(CNumber, y) < 0 Then retval = 0
Next
GetColumnB = retval
End Function
DECLARE SUB NeOtr (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER, SStr AS INTEGER, SStlb AS INTEGER)
DECLARE SUB Formirovanie (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER)
DIM A(5, 10) AS INTEGER, B(15, 12) AS INTEGER
DIM SStr AS INTEGER, SStlb AS INTEGER
CLS
CALL Formirovanie(A(), 5, 10)
PRINT
CALL Formirovanie(B(), 15, 12)
PRINT
CALL NeOtr(A(), 5, 10, SStr, SStlb)
PRINT "A: Stroki = ", SStr, "Stolbtsy = ", SStlb
CALL NeOtr(B(), 15, 12, SStr, SStlb)
PRINT "B: Stroki = ", SStr, "Stolbtsy = ", SStlb
END
SUB Formirovanie (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER)
FOR i = 1 TO UB
FOR j = 1 TO LB
arr(i, j) = INT(1 + 10 * RND)
PRINT arr(i, j);
NEXT j
PRINT
NEXT i
END SUB
SUB NeOtr (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER, SStr AS INTEGER, SStlb AS INTEGER)
DIM i AS INTEGER, j AS INTEGER
SStr = 0: SStlb = 0
FOR i = 1 TO LB
FOR j = 1 TO UB
IF arr(i, j) > 0 THEN SStr = SStr + 1
NEXT j
IF arr(i, j) > 0 THEN SStlb = SStlb + 1
NEXT i
END SUB
Option Explicit
Dim A() As Long, B() As Long
Sub main()
ReDim A(5, 10)
ReDim B(15, 12)
SUB NeOtr (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER, SStr AS INTEGER, SStlb AS INTEGER)
DIM i AS INTEGER, j AS INTEGER
DIM f AS Boolean
SStr = 0: SStlb = 0
FOR i = 1 TO UB
FOR j = 1 TO LB
IF arr(i, j) >= 0 THEN
SStr = SStr + 1
EXIT FOR
END IF
NEXT j
'IF arr(i, j) > 0 THEN SStlb = SStlb + 1
NEXT i
END SUB
DECLARE SUB NeOtrStr (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER, SStr AS INTEGER)
DECLARE SUB NeOtrStlb (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER, SStlb AS INTEGER)
OPTION BASE 1
DECLARE SUB NeOtr (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER, SStr AS INTEGER, SStlb AS INTEGER)
DECLARE SUB Formirovanie (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER)
DIM A(5, 10) AS INTEGER, B(15, 12) AS INTEGER
DIM SStr AS INTEGER, SStlb AS INTEGER
CLS
CALL Formirovanie(A(), 5, 10)
PRINT
CALL Formirovanie(B(), 15, 12)
PRINT
CALL NeOtrStr(A(), 5, 10, SStr)
CALL NeOtrStlb(A(), 5, 10, SStlb)
PRINT "A: Stroki = ", SStr, "Stolbtsy = ", SStlb
CALL NeOtrStr(B(), 15, 12, SStr)
CALL NeOtrStlb(B(), 15, 12, SStlb)
PRINT "B: Stroki = ", SStr, "Stolbtsy = ", SStlb
END
SUB Formirovanie (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER)
RANDOMIZE TIMER
FOR i = 1 TO UB
FOR j = 1 TO LB
arr(i, j) = INT(-9 + 12 * RND)
PRINT arr(i, j);
NEXT j
PRINT
NEXT i
END SUB
SUB NeOtrStlb (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER, SStlb AS INTEGER)
DIM i AS INTEGER, j AS INTEGER
SStlb = 0
FOR i = 1 TO LB
FOR j = 1 TO UB
IF arr(j, i) >= 0 THEN
SStlb = SStlb + 1
EXIT FOR
END IF
NEXT j
NEXT i
END SUB
SUB NeOtrStr (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER, SStr AS INTEGER)
DIM i AS INTEGER, j AS INTEGER
SStr = 0
FOR i = 1 TO UB
FOR j = 1 TO LB
IF arr(i, j) >= 0 THEN
SStr = SStr + 1
EXIT FOR
END IF
NEXT j
NEXT i
END SUB
DECLARE SUB NeOtrStr (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER, SStr AS INTEGER)
DECLARE SUB NeOtrStlb (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER, SStlb AS INTEGER)
OPTION BASE 1
DECLARE SUB NeOtr (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER, SStr AS INTEGER, SStlb AS INTEGER)
DECLARE SUB Formirovanie (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER)
DIM A(5, 10) AS INTEGER, B(15, 12) AS INTEGER
DIM SStr AS INTEGER, SStlb AS INTEGER
CLS
CALL Formirovanie(A(), 5, 10)
PRINT
CALL Formirovanie(B(), 15, 12)
PRINT
CALL NeOtrStr(A(), 5, 10, SStr)
CALL NeOtrStlb(A(), 5, 10, SStlb)
PRINT "A: Stroki = ", SStr, "Stolbtsy = ", SStlb
CALL NeOtrStr(B(), 15, 12, SStr)
CALL NeOtrStlb(B(), 15, 12, SStlb)
PRINT "B: Stroki = ", SStr, "Stolbtsy = ", SStlb
END
SUB Formirovanie (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER)
RANDOMIZE TIMER
FOR i = 1 TO UB
FOR j = 1 TO LB
arr(i, j) = INT(-9 + 12 * RND)
PRINT arr(i, j);
NEXT j
PRINT
NEXT i
END SUB
SUB NeOtrStlb (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER, SStlb AS INTEGER)
DIM i AS INTEGER, j AS INTEGER
SStlb = 0
FOR i = 1 TO LB
FOR j = 1 TO UB
IF arr(j, i) >= 0 THEN
SStlb = SStlb + 1
EXIT FOR
END IF
NEXT j
NEXT i
END SUB
SUB NeOtrStr (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER, SStr AS INTEGER)
DIM i AS INTEGER, j AS INTEGER
SStr = 0
FOR i = 1 TO UB
FOR j = 1 TO LB
IF arr(i, j) >= 0 THEN
SStr = SStr + 1
EXIT FOR
END IF
NEXT j
NEXT i
END SUB
DECLARE SUB NeOtrStr (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER, SStr AS INTEGER)
DECLARE SUB NeOtrStlb (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER, SStlb AS INTEGER)
OPTION BASE 1
DECLARE SUB NeOtr (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER, SStr AS INTEGER, SStlb AS INTEGER)
DECLARE SUB Formirovanie (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER)
DIM A(5, 10) AS INTEGER, B(15, 12) AS INTEGER
DIM SStr AS INTEGER, SStlb AS INTEGER
CLS
CALL Formirovanie(A(), 5, 10)
PRINT
CALL Formirovanie(B(), 15, 12)
PRINT
CALL NeOtrStr(A(), 5, 10, SStr)
CALL NeOtrStlb(A(), 5, 10, SStlb)
PRINT "A: Stroki = ", SStr, "Stolbtsy = ", SStlb
CALL NeOtrStr(B(), 15, 12, SStr)
CALL NeOtrStlb(B(), 15, 12, SStlb)
PRINT "B: Stroki = ", SStr, "Stolbtsy = ", SStlb
END
SUB Formirovanie (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER)
RANDOMIZE TIMER
FOR i = 1 TO UB
FOR j = 1 TO LB
arr(i, j) = INT(-9 + 12 * RND)
PRINT arr(i, j);
NEXT j
PRINT
NEXT i
END SUB
SUB NeOtrStlb (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER, SStlb AS INTEGER)
DIM i AS INTEGER, j AS INTEGER
SStlb = 0
FOR i = 1 TO LB
FOR j = 1 TO UB
IF arr(j, i) >= 0 THEN
SStlb = SStlb + 1
EXIT FOR
END IF
NEXT j
NEXT i
END SUB
SUB NeOtrStr (arr() AS INTEGER, UB AS INTEGER, LB AS INTEGER, SStr AS INTEGER)
DIM i AS INTEGER, j AS INTEGER
SStr = 0
FOR i = 1 TO UB
FOR j = 1 TO LB
IF arr(i, j) >= 0 THEN
SStr = SStr + 1
EXIT FOR
END IF
NEXT j
NEXT i
END SUB
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 181