二级计算机VB考试代码
第一套
1
Private Sub Command1_Click() Dim sum As Long 铁路施工
n = Val(Text1.Text) sum = 0 If n Mod 2 = 0 Then
' m = ?
Else
' m = ?
End If
' For i = 1 To m Step ?
' sum = sum + ? Next Label2.Caption = sum End Sub
Private Function f(ByVal x As Integer) As Long y = 1
' For i = 1 To ?
y = y * i Next f = y End Function
2
Option Base 1
Private Sub Command1_Click()
Dim days%, month%, year%, day1_1%, n%
Static month_days As Variant
month_days = Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
For k = 0 To 6
If Option1(k).Value = True Then
day1_1 = k
End If
Next k days = 0 month = Text2 year = Text1
' month_days(2) = IIf(leap_year(year), 29, ? )
'== 计算到要显示月历的月份之前共有多少天 ==
' For k = ? To month - 1
days = days + month_days(k) Next k
'==== 计算要显示月历的月份的第1天是星期几 =====
n = (days Mod 7 + day1_1) Mod 7
'================ 输出月历 ==================
Picture1.Cls
Picture1.Print " SUN MON TUE WED THU FRI SAT"
For k = 1 To month_days(month)
Picture1.Print Tab(5 * n + 1); k; n = n + 1
If n = 7 Then Picture1.Print
' n = ?
End If Next k End Sub
'============== 判断闰年 ==================
'Private Function leap_year( ? As Integer) As Boolean
leap_year = (year Mod 4 = 0 And year Mod 100 <> 0 Or year Mod 400 = 0)
End Function
Private Sub Option1_Click(Index As Integer) End Sub
3
Private Type rec
name As String * 3 Math As Integer
Chinese As Integer English As Integer End Type
Dim a(20) As rec, num As Integer, n As Integer
Private Sub readdata()
Open App.Path & "\" For Input As #1
k = 1 Do While Not EOF(1)
Input #1, a(k).name, a(k).Math, a(k).Chinese, a(k).English
k = k + 1 Loop Close #1
' num = ? End Sub
Private Sub Command1_Click()
n = 1 putdata n End Sub
Private Sub Command2_Click() n = n + 1 putdata n End Sub
Private Sub Command3_Click()星期一到星期日的英文
' n = ? putdata n End Sub
Private Sub Command4_Click()
n = num putdata n End Sub
Private Sub Form_Load()
Readdata Command1_Click End Sub
'Private Sub putdata( ? As Integer)
Label1.Caption = "第" & k & "条记录"
Text1 = a(k).name Text2 = a(k).Math Text3 = a(k).Chinese
Text4 = a(k).English
Text5 = a(k).Math + a(k).Chinese + a(k).English
' SetEnabled ? End Sub
qq音乐mv怎么下载Private Sub SetEnabled(m As Integer)
Command1.Enabled = IIf(m = 1, False, True)
Command2.Enabled = IIf(m = num, False, True)
Command3.Enabled = IIf(m = 1, False, True)
' Command4.Enabled = IIf( ? ) End Sub
第二套
1
Private Sub Form_Load()
Command1.Caption = "开始" Command2.Caption = "停止"
Timer1.Interval = 100 Timer1.Enabled = False
End Sub
Private Sub Command1_Click()
'Command1.Caption = ? Timer1.Enabled = True
'Command1.Enabled = ? Command2.Enabled = True
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False Command2.Enabled = False
'Command1.Enabled = ?
End Sub
Private Sub Timer1_Timer()
If HScroll1.Value < HScroll1.Max Then
'HScroll1.Value = ?
Else
'HScroll1.Value = ?
End If
End Sub
2
Private Sub Command1_Click()
'st1 = Trim( ? )
n = 1 st2 = UCase(Left(st1, 1))
Do While n <= Len(st1) If Mid(st1, n, 1) <> " " Then
'st2 = ? & Mid(st1, n + 1, 1) n = n + 1
End If
If Mid(st1, n, 1) = " " Then电脑分辨率设置
st2 = st2 & UCase(Mid(st1, n + 1, 1))
n = n + 1
End If
Loop
'Text2.Text = ?
End Sub
3
Function prime(ByVal n As Integer) As Boolean
' ****** 考生编写 ******
' ************************
End Function
Private Sub Form_Click()
' ****** 考生编写 ******
' ************************
Open App.Path & "\" For Output As #1
Print #1, Text1.Text
Close 1
End Sub
第三套
1
Private Sub Dir1_Change()
' File1.Path = ?
压力管理End Sub
Private Sub Drive1_Change()
' Dir1.Path = ?
End Sub
Private Sub File1_Click()
Label2.Caption = File1.FileName
End Sub
Private Sub Option1_Click(Index As Integer)
' If ? = 0 Then
Drive1.Drive = "c:\"
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论