| | |
how to use generate random numbers
![]() |
•
•
Join Date: Jul 2007
Posts: 7
Reputation:
Solved Threads: 0
Dear all
i have to do the exercise. The check boxes have 5 items: item 1, item2,..., item 5. Each item have one value. These values is in the range from 500 to 600.
There are 5 variables x, y, z, p, q.
The connstant number is 1800
When 3 items are checked, such as item 1 item 2, item 3, the program will generate x,y,z. And
item 1 * x+ item2*y+item3*z=1800
The same if 4 and 5 items are checked.
If 1 or 2 items are checked, the program will alert error.
I cannot do this exercise. I am waiting for anyone's help.
Thanks alot.
i have to do the exercise. The check boxes have 5 items: item 1, item2,..., item 5. Each item have one value. These values is in the range from 500 to 600.
There are 5 variables x, y, z, p, q.
The connstant number is 1800
When 3 items are checked, such as item 1 item 2, item 3, the program will generate x,y,z. And
item 1 * x+ item2*y+item3*z=1800
The same if 4 and 5 items are checked.
If 1 or 2 items are checked, the program will alert error.
I cannot do this exercise. I am waiting for anyone's help.
Thanks alot.
Hi,
To get random numbers, first Create a Function:
To Get five numbers,
after this, it would be easy to solve the expression...
Regards
Veena
To get random numbers, first Create a Function:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Public Function Rand(ByVal Low As Long, _ ByVal High As Long) As Long Rand = Int((High - Low + 1) * Rnd) + Low End Function
To Get five numbers,
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
dim N1,N2,N3,N4,N5 as long N1 = Rand(500, 600) N2 = Rand(500, 600) N3 = Rand(500, 600) N4 = Rand(500, 600) N5 = Rand(500, 600) ' Randomize '
after this, it would be easy to solve the expression...
Regards
Veena
![]() |
Similar Threads
- C++ Random Numbers (C++)
- Program will not generate random numbers (C++)
- need help, need to generate 10 random numbers, such that their sum is less than 1 (C)
- problem in generating non repeated random numbers (C)
- Trying to find a better way to generate random numbers in Dev Pascal (Pascal and Delphi)
- generate random question (C)
- random numbers all different??? (C++)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Permision denied error number 70
- Next Thread: Printing on Preprinted Stationary using VB
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





