This is a program that I am working on. It is supposed to simulate the roll of a pair of dice 100 times, then write the results to a file. Once the file is written, the user clicks the read file button to read the file. I have the write file/roll dice button working. I have the read file working, it displays the results in a textbox. What I need help with is to get the dice to roll 100 times instead of just one. So the read file results will show the results of 100 rolls of the dice. The file tab also has instructions as to how the program should work.
See the attached file.© BrainMass Inc. brainmass.com December 16, 2022, 10:15 am ad1c9bdddf
All computer programming languages have what are called Control Structures. They include branching structures ("if" and "case" statements) and looping structures ("while" loops, "for" loops, etc.).
The subset of Control Structures called "loops" allow you to execute commands multiple times, while only writing those commands once. The general flow of control in a loop is as follows:
A logical expression is evaluated. If it is true, the statements within the loop will be executed one at a time, until the bottom of the loop is reached. At that point the control returns to the top of the loop and the logical expression is checked again. If it is still true, the same statements within the loop are executed again, until the bottom of the loop is reached, and control returns to the top of the loop. If the control has returned to the top of the loop and the logical expression is considered false, the control of the program jumps to the first statement after the loop.
Please understand that is a general description of the flow of control. There are types of loops, for example, where the statements are always executed at least once, because the logical expression that controls whether the loop is executed is at the bottom of the loop. ...
In this brief document you will be shown how using a loop structure will allow you to execute the same commands multiple times. A thorough explanation of the flow of control when a loop is encountered is also presented.