#N88BASIC

Dim a As Long, b As Long, c As Long
Dim i As Long, q As Long
Dim seikai As Long
Dim qq As String
Randomize

Print "計算ゲーム"

*LL
Print "1:足し算"
Print "2:引き算"
Print "3:掛け算"
Print "4:割り算"
Input i
seikai = 0
Select Case i
Case 1
Gosub *TASIZAN
Case 2
Gosub *HIKIZAN
Case 3
Gosub *KAKEZAN
Case 4
Gosub *WARIZAN
End Select

Print "正解率=";seikai * 100 / 10; "%"
Input "続けますか?(y/N)";qq
If qq="y" Or qq="Y" Then *LL
End


*TASIZAN
For q=1 To 10
a = Int(Rnd() * 100)
b = Int(Rnd() * 100)
Print q;"問目 : ";a;"+";b;"=";
Input c
If a+b = c Then
Print "正解"
seikai = seikai + 1
Else
Print "不正解"
End If
Next
RETURN

*HIKIZAN
For q=1 To 10
a = Int(Rnd() * 100)
b = Int(Rnd() * 100)
Print q;"問目 : ";a;"-";b;"=";
Input c
If a-b = c Then
Print "正解"
seikai = seikai + 1
Else
Print "不正解"
End If
Next
RETURN

*KAKEZAN
For q=1 To 10
a = Int(Rnd() * 100)
b = Int(Rnd() * 100)
Print q;"問目 : ";a;"*";b;"=";
Input c
If a*b = c Then
Print "正解"
seikai = seikai + 1
Else
Print "不正解"
End If
Next
RETURN

*WARIZAN
For q=1 To 10
a = Int(Rnd() * 100)
Do
b = Int(Rnd() * 100)
Loop While b=0
Print q;"問目 : ";a;"/";b;"=";
Input c
If a/b = c Then
Print "正解"
seikai = seikai + 1
Else
Print "不正解"
End If
Next
RETURN
割り算に不具合?あり。