⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 水仙花.frm

📁 在VB5环境下开发的VB程序集,窗体控件源代码.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frm5_4_3 
   BackColor       =   &H0080FF80&
   Caption         =   "5-4-3:水仙花"
   ClientHeight    =   5475
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   8205
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   21.75
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   ScaleHeight     =   5475
   ScaleWidth      =   8205
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "计算"
      Height          =   435
      Left            =   3120
      TabIndex        =   4
      Top             =   4800
      Width           =   1575
   End
   Begin VB.CommandButton Command1 
      Caption         =   "计算"
      Height          =   435
      Left            =   3000
      TabIndex        =   3
      Top             =   2640
      Width           =   1695
   End
   Begin VB.Label Label3 
      BackColor       =   &H00FF00FF&
      Caption         =   "方法之二: For  B=1  to  9                   For  S=0  to  9                   For  G=0  to  9"
      Height          =   1335
      Left            =   600
      TabIndex        =   2
      Top             =   3240
      Width           =   6975
   End
   Begin VB.Label Label2 
      BackColor       =   &H000000FF&
      Caption         =   "方法之一:For i=100  to  999"
      Height          =   615
      Left            =   600
      TabIndex        =   1
      Top             =   1800
      Width           =   6975
   End
   Begin VB.Label Label1 
      BackColor       =   &H00C0FFFF&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "水仙花数是这样一位三位数,它的个位数的立方,加上十位数的立方,加上百位数的立方,正好等于这个三位数。"
      Height          =   1335
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   7695
   End
End
Attribute VB_Name = "frm5_4_3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim b, S, G
Private Sub Command1_Click()
For i = 100 To 999
b = Int(i / 100)
S = Int(i / 10) Mod 10
G = i Mod 10
If b ^ 3 + S ^ 3 + G ^ 3 = i Then
MsgBox (Str(b) & Str(S) & Str(G) & "是水仙花")
End If
Next
End Sub

Private Sub Command2_Click()
For b = 1 To 9
  For S = 0 To 9
    For G = 0 To 9
    If b ^ 3 + S ^ 3 + G ^ 3 = b * 100 + 10 * S + G Then
    MsgBox (Str(b) & Str(S) & Str(G) & "是水仙花")
    End If
    Next
  Next
Next
End Sub

⌨️ 快捷键说明

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