vb程序阅读题,第4题和第5题求过程解析和答案!谢谢!
1个回答
展开全部
4.
Private Sub Form_click()
Dim a, i As Integer
a = Array(1, 2, 3, 4, 5, 6, 7, 8, 9) '用array()函数给数组a()赋值a(0)=1,a(1)=2...a(8)=9
For i = 0 To 4
Print a(6 - i); '在同一行输出a(6-i)的值:依次是a(6)=7,a(5)=6,...a(2)=3即7 6 5 4 3
Next
End Sub
5
Public Enum workdays '定义一个数值序列变量只要给首个变量赋值,后面自动生成
sunday = 5 'sunday值为5
monday 'monday值就为6
tuesday
wednesday
thursday
friday 'friday值为10
saturday
End Enum
Private Sub Command1_Click()
Dim day As workdays '定义变量day为workdays类型的变量
day = friday '把friday的值赋给day
Print Val(day) '输出day的值,结果是10
End Sub
Private Sub Form_click()
Dim a, i As Integer
a = Array(1, 2, 3, 4, 5, 6, 7, 8, 9) '用array()函数给数组a()赋值a(0)=1,a(1)=2...a(8)=9
For i = 0 To 4
Print a(6 - i); '在同一行输出a(6-i)的值:依次是a(6)=7,a(5)=6,...a(2)=3即7 6 5 4 3
Next
End Sub
5
Public Enum workdays '定义一个数值序列变量只要给首个变量赋值,后面自动生成
sunday = 5 'sunday值为5
monday 'monday值就为6
tuesday
wednesday
thursday
friday 'friday值为10
saturday
End Enum
Private Sub Command1_Click()
Dim day As workdays '定义变量day为workdays类型的变量
day = friday '把friday的值赋给day
Print Val(day) '输出day的值,结果是10
End Sub
追问
感谢!( •̀∀•́ )
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询