ك آرايه كه تعداد خونه هاش از كاربر گرفته ميشه و در يك حلقه معين شروع به گرفتن يك مقدار تصادفي مي كنه.
کد:
Option Explicit
Option Base 1
کد:
Dim LowerBound, HighBound, Area As Integer
Dim mArray() As Integer
Dim HomeArray As Integer
Dim Counter As Integer
Dim ArrayValue As Integer
HomeArray = InputBox("Enter Number of few Home For mArray:", "Index of Value")
ReDim mArray(HomeArray) As Integer
'Creat Random Number
LowerBound = InputBox("Enter Lower Bound:", "Lower Bound of Area")
HighBound = InputBox("Enter High Bound:", "High Bound of Area")
Area = HighBound - LowerBound
For ArrayValue = LBound(mArray) To UBound(mArray)
mArray(ArrayValue) = Int(Rnd * Area) + LowerBound
Next ArrayValue
'Print MArray
For Counter = LBound(mArray) To UBound(mArray)
Print mArray(Counter) 'Print MArray in the Form
Next Counter