# Lab 4.0 - Quiz Show

Quiz shows have been around since the early days of broadcasting. Some, like this one, are based on random chance.

The rules of this Quiz Show are as follows. Two numbers are chosen randomly, between one and ten. A math operator is also randomly chosen (+, -, *, \ (integer division), or Mod). The contestant is shown the question, and then asked for the answer. Each incorrect guess makes the contestant lose one point, and each correct answer is scored based on the type of question it is:

 + 2 points - 3 points * 4 points \ 5 points Mod 6 points

After ten questions, the game ends and the final score is displayed.

Create an application that runs this Quiz Show for one contestant. Use a InputBox to get the answer from the user. Keep asking the user for the answer to a question until he or she gets it right. Keep a running total of the user's score, starting at zero, and report the score at the end of the game.

You'll need:
• A Label for the directions
• Four Labels for the question:
• A Label for the first number
• A Label for the math operator to be used
• A Label for the second number
• A Button to start the game.

HINTS: Use either a Do-Loop-While or a Do-While-Loop (you'll have to figure out which) to run the answer algorithm until the user gets it right. You'll need a variable for the score. You'll also have to figure out a good algorithm for selecting a random operator. This isn't an obvious lab, so try using decomposition first!

Here's the code I used:

```'Aaron Pavao
'31 October 2013
'Quiz Show
'A game that asks math questions.
'Kidnap the Sandy Claws, hit him with a stick

Public Class frmQuizShow

Private Sub btnPlay_Click(sender As Object, e As EventArgs) Handles btnPlay.Click
'loop for 10 questions
'   generate the question
'   display the question
'       ask, if correct then done
'       if wrong then -1 point
'   display result
'display final score

Dim intQuestion As Integer
Dim intScore As Integer
Dim intNum1 As Integer, intNum2 As Integer
Dim intOp As Integer
Dim intAnswer As Integer, intResponse As Integer

For intQuestion = 1 To 10
intNum1 = Int(Rnd() * 10) + 1
intNum2 = Int(Rnd() * 10) + 1
intOp = Int(Rnd() * 5) + 2

lblNum1.Text = intNum1
lblNum2.Text = intNum2

If intOp = 2 Then
lblOp.Text = "+"
ElseIf intOp = 3 Then
lblOp.Text = "-"
ElseIf intOp = 4 Then
lblOp.Text = "*"
ElseIf intOp = 5 Then
lblOp.Text = "\"
ElseIf intOp = 6 Then
lblOp.Text = "Mod"
End If

Do
MsgBox("Correct!", , "Good!")
intScore += intOp
Else
MsgBox("Try again.", , "Wrong")
intScore -= 1
End If