📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 975
Left = 960
TabIndex = 0
Top = 960
Width = 2535
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 num As Integer
Dim indiv As Integer '个位
Dim ten As Integer '十位
Dim hundred As Integer '百位
Dim thousand As Integer '千位
Dim place As Integer '位数
num = Val(InputBox("请输入一个正整数(0~9999)"))
'确定位数
If num > 999 Then
place = 4
ElseIf num > 99 Then
place = 3
ElseIf num > 9 Then
place = 2
Else
place = 1
End If
'确定各位数的数字
thousand = num \ 1000
hundred = (num - thousand * 1000) \ 100 '百位数
ten = (num - thousand * 1000 - hundred * 100) \ 10 '十位数
indiv = num - thousand * 1000 - hundred * 100 - ten * 10
'各位数
'正序、逆序输出各位数
Select Case place
Case 4
Print thousand, hundred, ten, indiv
Print indiv, ten, hundred, thousand
Case 3
Print hundred, ten, indiv
Print indiv, ten, hundred
Case 2
Print ten, indiv
Print indiv, ten
Case 1
Print indiv
Print indiv
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -