📄 sy07.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "歌德巴赫猜想验证器"
ClientHeight = 7245
ClientLeft = 60
ClientTop = 450
ClientWidth = 9720
LinkTopic = "Form1"
ScaleHeight = 7245
ScaleWidth = 9720
StartUpPosition = 3 '窗口缺省
Begin VB.PictureBox Picture1
BeginProperty Font
Name = "Tahoma"
Size = 27.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 3120
ScaleHeight = 675
ScaleWidth = 5475
TabIndex = 7
Top = 5760
Width = 5535
End
Begin VB.CommandButton Command1
Caption = "验 证"
BeginProperty Font
Name = "宋体"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 1320
TabIndex = 6
Top = 5760
Width = 1575
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "Tahoma"
Size = 27.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 675
Left = 1320
TabIndex = 5
Text = "50"
Top = 4680
Width = 5895
End
Begin VB.Frame Frame2
Caption = " 验证 "
BeginProperty Font
Name = "宋体"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 3855
Left = 600
TabIndex = 3
Top = 3000
Width = 8415
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "请输入一个大于或等于6的偶数"
BeginProperty Font
Name = "黑体"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 435
Left = 720
TabIndex = 4
Top = 840
Width = 5880
End
End
Begin VB.Frame Frame1
Caption = " 歌德巴赫猜想 "
BeginProperty Font
Name = "宋体"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2415
Left = 600
TabIndex = 0
Top = 240
Width = 8415
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "都可以分解为两个素数之和"
BeginProperty Font
Name = "楷体_GB2312"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 435
Left = 2160
TabIndex = 2
Top = 1560
Width = 5580
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "任何一个大于或等于6的偶数"
BeginProperty Font
Name = "楷体_GB2312"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 435
Left = 960
TabIndex = 1
Top = 840
Width = 5820
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim s As String * 1
Private Sub Text1_KeyPress(KeyAscii As Integer)
s = Chr(KeyAscii)
Select Case s
Case "0" To "9"
Case Else
KeyAscii = 0
End Select
End Sub
Private Sub Command1_Click()
If Val(s) Mod 2 <> 0 Or Val(Text1.Text) < 6 Then
MsgBox "请输入大于或等于6的偶数", 0, "输入错误"
Text1.SetFocus
Exit Sub
End If
Picture1.Cls
Dim i&, a&
a = Val(Text1.Text)
For i = 3 To a \ 2 step 2
If sushu(i) And sushu(a - i) Then
Picture1.Print a & "=" & i & "+" & (a - i)
Exit For
End If
Next i
End Sub
Public Function sushu(k) As Boolean
Dim j&
For j = 2 To Int(Sqr(k))
If (k Mod j) = 0 Then
sushu = False
GoTo F
End If
Next j
sushu = True
F:
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -