I am writing a qb64 / QBasic software program to convert a numerical grade 0-100 to a letter grade (a,b,c,d,f). I have set it up so that strings/arrays are used to allow infinite grades to be entered. However when I try to calculate the letter grade and call it back to print with calcGrade!(MyList(Index%)) I receive the error "Number required for function" Can anyone help me with this?
ReDim MyList(0) As String
Dim Grade
Dim Index%
_Title "Letter Grade Calculator"
Print "Enter your numerical grades. To finish enter (exit)"
Do While Grade$ <> "exit"
Input "Enter Grade"; Grade$
If Grade$ <> "exit" Then
Index% = Index% + 1
ReDim _Preserve MyList(Index%)
MyList(Index%) = Grade$
End If
Loop
Cls
For Index% = 1 To UBound(MyList)
Print MyList(Index%);
Print "Letter Grade:"; calcGrade!(MyList(Index%))
Next Index%
Function calcGrade! (numGrade)
Select Case val(numGrade)
Case is > 100
calcGrade! = "A+"
Case Is > 90
calcGrade! = "A"
Case Is > 80
calcGrade! = "B"
Case Is > 70
calcGrade! = "C"
Case Is > 60
calcGrade! = "D"
Case Is > 50
calcGrade! = "F"
Case Else
calcGrade! = "ERROR: Invalid character"
End Select
End Function