想必现在有很多小伙伴对于vb 考试题方面的知识都比较想要了解,那么今天小好小编就为大家收集了一些关于vb 考试题方面的知识分享给大家,希望大家会喜欢哦。
1、 在对话框中输入圆的半径,输出计算出的圆的面积。用Inputbox函数来输入数据,话框的标题为“计算机的面积”,提示信息为“请输入半径”,输入区默认值为“1”
Option Explicit
Private Sub Form_Load()
芝难士省回答,版权必究,未经须许可,不得方转做载
'1、 在对话框中输入圆的半径,输出计算出的圆的面积。
就好由只最统确段备号格,厂属该。
' 用Inputbox函数来输入数据,话框的标题为“计算机的面积”
' ,提示信息为“请输入半径”,输入区默认值为“1”
我们进合四无代七东改才温值易参。
Dim banjing As Long
Dim mianji As Single
Dim PI As Single
PI = 3.14159
banjing = InputBox("请输入半径","面积计算", 1)
mianji = banjing * banjing * PI
Me.AutoRedraw = True
Print mianji
End Sub
5、 如果一个三位整数等于它的各位数字立方和,则称此数位“水仙花数”,如“153=13+15+33”,设计一个程序,求出所有的三位水仙花数。
Private Sub Command1_Click()
Dim i As Long
Dim j As Long
Dim K As Long
Dim Shu As Long
Dim shuixianhua As Long
For i = 1 To 9
For j = 0 To 9
For K = 0 To 9
Shu = i * 100 + j * 10 + K * 1 '生成三位数
shuixianhua = i * i * i + j * j * j + K * K * K
If Shu = shuixianhua Then
Me.Picture1.Print Shu
End If
Next K
Next j
Next i
Me.Picture1.Print"别忘了给分"
End Sub
Private Sub Form_Load()
Picture1.AutoRedraw = True
End Sub
结果
153
370
371
407
------------
8、 求S=1/(1+4) +1/(1+2*4)+ 1/(1+3*4)+……+1/(1+n*4)的前100项之和。
Option Explicit
Private Sub Form_Load()
'8、 求S=1/(1+4) +1/(1+2*4)+ 1/(1+3*4)+……+1/(1+n*4)的前100项之和。
Dim S As Single
Dim i As Long
For i = 1 To 100
S = S + 1 / (1 + i * 4)
Next i
Me.AutoRedraw = True
Print S
End Sub
-------------------
Option Explicit
Private Sub Form_Load()
' 在窗体中打印九九乘法表,需显示乘数和被乘数,例“1*1=1”
Me.AutoRedraw = True
Dim i As Long
Dim j As Long
For i = 1 To 9
For j = 1 To i
Dim PrintString As String
PrintString = (i &"*"& j &"="& i * j &"")
Print Left(PrintString, 8);
Next j
Next i
End Sub
--------------------------
建议你把题目分开来,每题来到题,都给分数。
这样才有人愿意帮你做
本文到此结束,希望对大家有所帮助。