Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public partial class Quiz : Form
- {
- private int score;//punkty
- private int questionNumber=0;//numer pytania
- private String anserw;//odpowiedz
- public Quiz()
- {
- InitializeComponent();
- }
- private void Quiz_Load(object sender, EventArgs e)
- {
- loadNextQuestion();
- }
- private void loadNextQuestion()
- {
- questionNumber++;
- switch (questionNumber)
- {
- case 1: questionsLabel.Text = "2+2?";
- buttonA.Text = "6";
- buttonB.Text = "8";
- buttonC.Text = "4";
- buttonD.Text = "5";
- anserw = "4";
- break;
- case 2:
- questionsLabel.Text = "5 * 5?";
- buttonA.Text = "25";
- buttonB.Text = "20";
- buttonC.Text = "30";
- buttonD.Text = "55";
- anserw = "25";
- break;
- case 3:
- questionsLabel.Text = "Kto wygral Lige mistrzow w 2017 roku?";
- buttonA.Text = "Real Madird";
- buttonB.Text = "FC Barcelona";
- buttonC.Text = "AC Milan";
- buttonD.Text = "Manchester United";
- anserw = "Real Madird";
- break;
- case 4:
- questionsLabel.Text = "Kto wygral Lige mistrzow w 2016 roku?";
- buttonA.Text = "PSG";
- buttonB.Text = "Atletico Madrid";
- buttonC.Text = "Real Madird";
- buttonD.Text = "Manchester City";
- anserw = "Real Madird";
- break;
- case 5:
- questionsLabel.Text = "Kto wygral Premier League w 2017 roku?";
- buttonA.Text = "Arsenal";
- buttonB.Text = "Chelsea";
- buttonC.Text = "Manchester United";
- buttonD.Text = "Manchester City";
- anserw = "Chelsea";
- break;
- default: questionsLabel.Text = "Twoj koncowy wynik to: "+score;
- break;
- }
- }
- private void buttonA_Click(object sender, EventArgs e)
- {
- string choice = buttonA.Text;
- if(choice== anserw)
- {
- infoLabel.Text = "Dobra odpowiedz";
- score++;
- }
- else
- {
- infoLabel.Text = "Zla odpowiedz";
- }
- scoreLabel.Text = "Score : " + score;
- loadNextQuestion();
- }
- private void buttonB_Click(object sender, EventArgs e)
- {
- string choice = buttonB.Text;
- if (choice == anserw)
- {
- infoLabel.Text = "Dobra odpowiedz";
- score++;
- }
- else
- {
- infoLabel.Text = "Zla odpowiedz";
- }
- scoreLabel.Text = "Score : " + score;
- loadNextQuestion();
- }
- private void buttonC_Click(object sender, EventArgs e)
- {
- string choice = buttonC.Text;
- if (choice == anserw)
- {
- infoLabel.Text = "Dobra odpowiedz";
- score++;
- }
- else
- {
- infoLabel.Text = "Zla odpowiedz";
- }
- scoreLabel.Text = "Score : " + score;
- loadNextQuestion();
- }
- private void buttonD_Click(object sender, EventArgs e)
- {
- string choice = buttonD.Text;
- if (choice == anserw)
- {
- infoLabel.Text = "Dobra odpowiedz";
- score++;
- }
- else
- {
- infoLabel.Text = "Zla odpowiedz";
- }
- scoreLabel.Text = "Score : " + score;
- loadNextQuestion();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement