ZKX's LAB

VB水仙花数 水仙花数vb

2021-04-27知识2

VB “水仙花数”实现代码 计算代码 Visual Basic v6.0 方法/步骤 1 双击桌面图标启动 visual basic 6.0 2 。3 然后双击 FORM1 窗体,在弹出的代码窗体中复制该代码到 Form_Click()事件中。。

VB水仙花数 Private Sub Command1_Click()Dim i%,a%,b%,c%For i=100 To 999a=Val(Left(i,1))b=Val(Mid(i,2,1))c=Val(Right(i,1))If i=a^3+b^3+c^3 Then Picture1.Print iNextEnd Sub

VB判断水仙花数,急~~~~~~~~~~~~~~~ Private Sub Command1_Click()Dim s As Integer,a As Integer,b As Integer,c As Integers=Val(Text1.Text)If Trim(Str(s))=Text1.Text And Len(Text1.Text)=3 Thena=s \\ 100b=s \\ 10 Mod 10c=s Mod 10If s=a^3+b^3+c^3 Then label1.caption=s&\"是水仙花数\"Else label1.caption=s&\"不是水仙花数Elselabel1.caption=\"不是一个合理的三位数End IfEnd Sub

#水仙花数vb#vb找出水仙花数#水仙花数

随机阅读

qrcode
访问手机版