水仙花数(方法一).frm
来自「算法教案」· FRM 代码 · 共 58 行
FRM
58 行
VERSION 5.00
Begin VB.Form Form1
Caption = "水仙花数"
ClientHeight = 4710
ClientLeft = 60
ClientTop = 450
ClientWidth = 5880
LinkTopic = "Form1"
ScaleHeight = 4710
ScaleWidth = 5880
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "计算"
Height = 495
Left = 4080
TabIndex = 1
Top = 2760
Width = 975
End
Begin VB.ListBox List1
Height = 3660
ItemData = "水仙花数(方法一).frx":0000
Left = 240
List = "水仙花数(方法一).frx":0002
TabIndex = 0
Top = 480
Width = 3375
End
Begin VB.Label Label1
Height = 735
Left = 3840
TabIndex = 2
Top = 840
Width = 1815
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim sum As Integer
Dim i, a, b, c As Integer
List1.Clear
For i = 100 To 999
a = i \ 100
b = i \ 10 Mod 10
c = i Mod 10
If a ^ 3 + b ^ 3 + c ^ 3 = i Then
List1.AddItem (Str(i))
sum = sum + 1
End If
Next i
Label1.Caption = "个数:" + Str(sum)
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?