I'm trying to keep score and other than the very first question, nothing else registers. The if-statement seems to work other than the whole not keeping score
if (correctAns == ans1 && ans1RadioBtn.Checked == true)
{
correctAnsLabel.Text = "Correct!";
score = +1;
scoreLabel.Text = "Total Score: 100 Your Score: " + score;
}
else if (correctAns == ans2 && ans2RadioBtn.Checked == true)
{
correctAnsLabel.Text = "Correct!";
score = +1;
scoreLabel.Text = "Total Score: 100 Your Score: " + score;
}
else if (correctAns == ans3 && ans3RadioBtn.Checked == true)
{
correctAnsLabel.Text = "Correct!";
score = +1;
scoreLabel.Text = "Total Score: 100 Your Score: " + score;
}
else if (correctAns == ans4 && ans4RadioBtn.Checked == true)
{
correctAnsLabel.Text = "Correct!";
score = +1;
scoreLabel.Text = "Total Score: 100 Your Score: " + score;
}
else
{
correctAnsLabel.Text = "Incorrect. The answer is " + correctAns + "!";
score = -1;
scoreLabel.Text = "Total Score: 100 Your Score: " + score;
}
I have no idea why it won't keep the damn score!
Aucun commentaire:
Enregistrer un commentaire