例2-18.frm

来自「Visual Basic程序设计基础》-杨小影-源代码」· FRM 代码 · 共 36 行

FRM
36
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   1860
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3975
   LinkTopic       =   "Form1"
   ScaleHeight     =   1860
   ScaleWidth      =   3975
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "单击此按钮得到1000以内的水仙花数"
      Height          =   615
      Left            =   240
      TabIndex        =   0
      Top             =   1080
      Width           =   3495
   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 i As Integer, j As Integer, k As Integer, n As Integer
For n = 100 To 999
       i = Int(n / 100)
       j = Int(n / 10) - i * 10
       k = n Mod 10
If n = i * i * i + j * j * j + k * k * k Then Print n;
Next n
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?