Can somebody help me with my scoring system?
Hi i'm trying to create a basic maths quiz which will firstly ask the student 3 questions and display how many he has scored out of 10, but i can't seem to get the score to work, this is what i have got so far:
Code:
Public Class Form1
'Randomiser function
Public Function rand(ByVal low As Long, _
ByVal high As Long) As Long
rand = Int((high - low + 1) * Rnd()) + low
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Variables which will be declaring throughout the code
Dim highnum As Integer
Dim lownum As Integer
Dim answer As Integer
Dim score As Integer
Dim addition As Integer
score = 1
addition = 1
'This section will be the first section of the code, which will diplay 4 addition sums
Do While addition < 4
highnum = rand(1, 12)
lownum = rand(1, 6)
answer = highnum + lownum
If InputBox("What is " & highnum & "+" & lownum) = answer Then
score = score + 1 & MsgBox("well done" & score)
End If
addition = addition + 1
Loop
MsgBox("You have scored" & score & "out of 10")
Re: Can somebody help me with my scoring system?
Quote:
score = score + 1 & MsgBox("well done" & score)
You need to get that part in red off that line.
If you want to add to the score then that is one line
display the score should be another line.
Also note that you should not start more than one thread on the same question. I have deleted the thread you created in the VB6 section as this is VB.Net code.
You shoudl also be more descriptive than just saying it doesn't work. Many will not even bother to try and help when you fail to provide the required info. In this case I would guess that you are getting a Type Mismatch error message on the line I have quoted.