I need to create an application that displays math problems by randomly generating two numbers, 1 through 10, and an operator (*, -, /, +) and prompts the user for an answer. The application should check the answer and display a message, display the correct answer and generate a new problem.(High school programing)
But Iam having problems on how to do the second operator. This is how did the first B,
]Dim rnd As New System.Random
Private Sub btnProblem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProblem.Click
'Purpose- to Create an application math problems by randomly generating 2 numbers , 1-10 & operators (/*-+)& prompts the user for an answer
'Input- the answer
'output- the problem, a prompt telling the user whether he is right & the answer
Dim t As Integer
Dim y As Integer
Dim answer As Integer
Dim guess As Integer
If Me.lbl2.Text = "+" Then
End If
y = rnd.Next(10)
t = rnd.Next(10)
Me.lblR.Text = y
Me.lblt.Text = t
Me.lbl2.Text = "+"
guess = Me.txtanswer.Text
answer = t + y
Private Sub btnchecck_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnchecck.Click
Dim t As Integer
Dim y As Integer
Dim guess As Integer
Dim answer As String
y = rnd.Next(10)
t = rnd.Next(10)
Me.lblR.Text = y
Me.lblt.Text = t
Me.lbl2.Text = "+"
guess = Me.txtanswer.Text
answer = t + y
If guess = answer Then
Me.lblanswercheck.Text = " The answer is correct"
Else
Me.lblanswercheck.Text = " The answer is wrong"
Private Sub btnAnswer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAnswer.Click
Dim t As Integer
Dim y As Integer
Dim guess As Integer
Dim answer As String
y = rnd.Next(10)
t = rnd.Next(10)
Me.lblR.Text = y
Me.lblt.Text = t
Me.lbl2.Text = "+"
guess = Me.txtanswer.Text
answer = t + y
If guess = answer Then
Me.lblanswercheck.Text = "the answer is coorect"
Else
Me.lblanswercheck.Text = " The answer is " & answer
End If
End Sub
End Class