📄 07.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 6165
ClientLeft = 60
ClientTop = 345
ClientWidth = 5460
LinkTopic = "Form1"
ScaleHeight = 6165
ScaleWidth = 5460
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame2
Caption = "验证"
Height = 5175
Left = 480
TabIndex = 2
Top = 2280
Width = 4215
Begin VB.PictureBox Picture1
Height = 3015
Left = 1920
ScaleHeight = 2955
ScaleWidth = 1875
TabIndex = 6
Top = 1680
Width = 1935
End
Begin VB.CommandButton Command1
Caption = "验证"
Height = 375
Left = 480
TabIndex = 5
Top = 1800
Width = 855
End
Begin VB.TextBox Text1
Height = 375
Left = 480
TabIndex = 4
Top = 1080
Width = 3015
End
Begin VB.Label Label2
Caption = "请输入一个大于或等于6的偶数"
BeginProperty Font
Name = "华文行楷"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 3
Top = 480
Width = 3375
End
End
Begin VB.Frame Frame1
Caption = "歌德巴赫猜想"
Height = 1095
Left = 480
TabIndex = 0
Top = 240
Width = 4215
Begin VB.Label Label1
Caption = "任何大于或等于6的偶数 都可以分解为两个素数之和"
BeginProperty Font
Name = "华文行楷"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 720
TabIndex = 1
Top = 360
Width = 2895
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Function sushu(n As Long) As Integer
Dim i As Long
For j = 2 To n
For i = 2 To Int(Sqr(j))
If (j Mod i) = 0 Then
sushu = -1
GoTo no
End If
Next i
sushu = 1
no:
Next j
End Function
Private Sub Command1_Click()
Dim n As Long, m As Long
Picture1.Cls
n = Text1.Text
If Text1.Text < 6 And Text1.Text Mod 2 <> 0 Then
MsgBox "输入信息错误,请重新输入"
ElseIf n >= 6 And (n Mod 2) = 0 Then
For m = 3 To n \ 2
If sushu(m) = 1 And sushu(n - m) = 1 Then
Picture1.Print n & "=" & m & "+" & (n - m)
End If
Next m
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -