Guest User

Untitled

a guest
Nov 22nd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. private void generateButton_Click(object sender, EventArgs e)
  2. {
  3. // Create an array to hold the numbers.
  4. const int SIZE = 5;
  5. int[] lotteryNumbers = new int[SIZE];
  6.  
  7. // Create a Random object.
  8. Random rand = new Random();
  9.  
  10. // Fill the array with random numbers, in the range // of 0 through 99.
  11. for (int index = 0; index < lotteryNumbers.Length; index++)
  12. {
  13. lotteryNumbers[index] = rand.Next(100);
  14. }
  15.  
  16. // Display the array elements in the Label controls.
  17. firstLabel.Text = lotteryNumbers[0].ToString();
  18. secondLabel.Text = lotteryNumbers[1].ToString();
  19. thirdLabel.Text = lotteryNumbers[2].ToString();
  20. fourthLabel.Text = lotteryNumbers[3].ToString();
  21. fifthLabel.Text = lotteryNumbers[4].ToString();
  22. }
  23.  
  24. private void exitButton_Click(object sender, EventArgs e)
  25. {
  26. // Close the form.
  27. this.Close();
  28. }
  29.  
  30. declare resultVariable
  31.  
  32. loop all numbers in lotteryNumbers
  33. add current number in lotteryNumbers to resultVariable
Add Comment
Please, Sign In to add comment