Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.19 KB | None | 0 0
  1. public partial class Quiz : Form
  2. {
  3. private int score;//punkty
  4. private int questionNumber=0;//numer pytania
  5. private String anserw;//odpowiedz
  6. public Quiz()
  7. {
  8. InitializeComponent();
  9. }
  10.  
  11. private void Quiz_Load(object sender, EventArgs e)
  12. {
  13. loadNextQuestion();
  14. }
  15. private void loadNextQuestion()
  16. {
  17. questionNumber++;
  18. switch (questionNumber)
  19. {
  20.  
  21. case 1: questionsLabel.Text = "2+2?";
  22. buttonA.Text = "6";
  23. buttonB.Text = "8";
  24. buttonC.Text = "4";
  25. buttonD.Text = "5";
  26. anserw = "4";
  27. break;
  28.  
  29. case 2:
  30. questionsLabel.Text = "5 * 5?";
  31. buttonA.Text = "25";
  32. buttonB.Text = "20";
  33. buttonC.Text = "30";
  34. buttonD.Text = "55";
  35. anserw = "25";
  36. break;
  37.  
  38. case 3:
  39. questionsLabel.Text = "Kto wygral Lige mistrzow w 2017 roku?";
  40. buttonA.Text = "Real Madird";
  41. buttonB.Text = "FC Barcelona";
  42. buttonC.Text = "AC Milan";
  43. buttonD.Text = "Manchester United";
  44. anserw = "Real Madird";
  45. break;
  46.  
  47. case 4:
  48. questionsLabel.Text = "Kto wygral Lige mistrzow w 2016 roku?";
  49. buttonA.Text = "PSG";
  50. buttonB.Text = "Atletico Madrid";
  51. buttonC.Text = "Real Madird";
  52. buttonD.Text = "Manchester City";
  53. anserw = "Real Madird";
  54. break;
  55.  
  56. case 5:
  57. questionsLabel.Text = "Kto wygral Premier League w 2017 roku?";
  58. buttonA.Text = "Arsenal";
  59. buttonB.Text = "Chelsea";
  60. buttonC.Text = "Manchester United";
  61. buttonD.Text = "Manchester City";
  62. anserw = "Chelsea";
  63. break;
  64.  
  65. default: questionsLabel.Text = "Twoj koncowy wynik to: "+score;
  66. break;
  67. }
  68. }
  69.  
  70. private void buttonA_Click(object sender, EventArgs e)
  71. {
  72. string choice = buttonA.Text;
  73. if(choice== anserw)
  74. {
  75. infoLabel.Text = "Dobra odpowiedz";
  76. score++;
  77. }
  78. else
  79. {
  80. infoLabel.Text = "Zla odpowiedz";
  81. }
  82. scoreLabel.Text = "Score : " + score;
  83. loadNextQuestion();
  84. }
  85.  
  86. private void buttonB_Click(object sender, EventArgs e)
  87. {
  88. string choice = buttonB.Text;
  89. if (choice == anserw)
  90. {
  91. infoLabel.Text = "Dobra odpowiedz";
  92. score++;
  93. }
  94. else
  95. {
  96. infoLabel.Text = "Zla odpowiedz";
  97. }
  98. scoreLabel.Text = "Score : " + score;
  99. loadNextQuestion();
  100. }
  101.  
  102. private void buttonC_Click(object sender, EventArgs e)
  103. {
  104. string choice = buttonC.Text;
  105. if (choice == anserw)
  106. {
  107. infoLabel.Text = "Dobra odpowiedz";
  108. score++;
  109. }
  110. else
  111. {
  112. infoLabel.Text = "Zla odpowiedz";
  113. }
  114. scoreLabel.Text = "Score : " + score;
  115. loadNextQuestion();
  116. }
  117.  
  118. private void buttonD_Click(object sender, EventArgs e)
  119. {
  120. string choice = buttonD.Text;
  121. if (choice == anserw)
  122. {
  123. infoLabel.Text = "Dobra odpowiedz";
  124. score++;
  125. }
  126. else
  127. {
  128. infoLabel.Text = "Zla odpowiedz";
  129. }
  130. scoreLabel.Text = "Score : " + score;
  131. loadNextQuestion();
  132. }
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement