Advertisement
Guest User

Untitled

a guest
Feb 4th, 2013
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. private void btnSlumpa_Click(object sender, RoutedEventArgs e)
  2. {
  3.  
  4.  
  5. Random slumptal = new Random();
  6.  
  7. int tal1 = slumptal.Next(1, 7);
  8. resultat1.Text = Convert.ToString(tal1);
  9.  
  10. int tal2 = slumptal.Next(1, 7);
  11. resultat2.Text = Convert.ToString(tal2);
  12.  
  13. int tal3 = slumptal.Next(1, 7);
  14. resultat3.Text = Convert.ToString(tal3);
  15.  
  16. int tal4 = slumptal.Next(1, 7);
  17. resultat4.Text = Convert.ToString(tal4);
  18.  
  19. int tal5 = slumptal.Next(1, 7);
  20. resultat5.Text = Convert.ToString(tal5);
  21.  
  22. int tal6 = slumptal.Next(1, 7);
  23. resultat6.Text = Convert.ToString(tal6);
  24.  
  25.  
  26. List<int> utfall = new List<int>(); // ny lista
  27. utfall.Add("antalEttor"); // lägger till ett element i listan
  28. utfall.Add("antalTvåor"); // lägger till ett element i listan
  29. utfall.Add("antalTreor"); // lägger till ett element i listan
  30. utfall.Add("antalFyror"); // lägger till ett element i listan
  31. utfall.Add("antalFemmor"); // lägger till ett element i listan
  32. utfall.Add("antalSexor"); // lägger till ett element i listan
  33.  
  34. foreach(
  35. {
  36.  
  37. }
  38.  
  39.  
  40. utfall1.Text = Convert.ToString(antalEttor); // printar ut antal ettor
  41. utfall2.Text = Convert.ToString(antalTvåor); // printar ut antal tvåor
  42. utfall3.Text = Convert.ToString(antalTreor); // printar ut antal treor
  43. utfall4.Text = Convert.ToString(antalFyror); // printar ut antal fyror
  44. utfall5.Text = Convert.ToString(antalFemmor); // printar ut antal femmor
  45. utfall6.Text = Convert.ToString(antalSexor); // printar ut antal sexor
  46.  
  47.  
  48. } // end button
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement