'作成 2019/05/12 'プログラミングの考え方:さいころを 2つ使って 1桁の足し算を自動生成してみる Print "2桁までの足し算と引き算の問題を自動生成します。" Print 'このアプリは、コンソールの既定値のフォント・サイズを使って表示します。 Print "(文字の大きさは、コマンド プロンプトの「既定値」" Print "のフォントサイズで設定して下さい。)" Print '--------------------------------------------------- '参考にさせて頂いた掲示 'change console mode font 'by MichaelW ≫ Feb 14, 2008 15:59 'https://www.freebasic.net/forum/viewtopic.php?t=10651 '====================================================================== #Include "windows.bi" '====================================================================== Dim As HKEY hKey2 Dim As DWORD fontSize '--------------------------------------------------- '' For RegSetValueEx return value ERROR_SUCCESS = 0. '--------------------------------------------------- RegSetValueEx( hKey2, "FontSize", 0, REG_DWORD, _ Cast(LPSTR,@fontSize), SizeOf(DWORD) ) '指定されたレジストリキーの指定された 1 つのレジストリエントリのデータとデータ型を設定します。 '--------------------------------------------------- '結果が2桁までの加算と減算を自動生成する。 Dim A As Integer Dim B As Integer Dim S As Integer Dim Calculation As String Dim KeyInput As Integer Input "算法(足し算=a 引き算=s)を入力して下さい。"; Calculation Print Randomize Do Do A = Rnd * 99.4 B = Rnd * 99.4 S = A+B Loop While S >= 100 If Calculation="a" Then Print Using " ## + ## = "; A; B; Sleep Print Using "## [Esc]キーで抜ける"; S Else Print Using " ## - ## = "; S; A; Sleep Print Using "## [Esc]キーで抜ける"; B End If print KeyInput = GetKey Loop Until KeyInput = 27 ' [27]=[Esc] キー入力するまで、繰返す