题库 高中信息

题干

玫瑰花数是一个四位正整数,该数每一位上的数字4次方之和等于它本身。如:1634=14+64+34+44,小张设计VB程序用于找出所有可能的玫瑰花数,程序运行界面如下图所示。

(1)在窗体中要显示玫瑰花图像(文件名为flower.bmp),需添加图像框image1,并设置其________属性(单选,填字母:
A.Image/B.Pictrue/C.Caption/D.Text)的值为“flower.bmp”。
(2)为实现上述功能,请在划线处填入合适的代码。
Private Sub Command1_Click()
Dim sum As Integer, a As Integer, b As Integer
Dim i As Integer, c As Integer, d As Integer
List1.Clear
sum = 0     '玫瑰花个数
For i = 1000 To 9999
a = i Mod 10  '求个位上的数字
b =  ①______  '求十位上的数字
c = i \ 100 Mod 10 '求百位上的数字
d = i \ 1000  '求千位上的数字
If a ^ 4 + b ^ 4 + c ^ 4 + d ^ 4 = i Then
List1.AddItem Str(i)
②________
End If
Next i
Label1.Caption = "玫瑰花个数为:" + Str(sum)
End Sub
(3)解决该问题主要采用的算法是________
上一题 下一题 0.99难度 填空题 更新时间:2019-04-05 08:38:02

答案(点此获取答案解析)