计算机二级考试模拟试题第八套,全国计算机二级第八套上机考试试题~~~.doc

Private x As Integer

Private Sub Command1_Click()

x = Val(InputBox("请输入正整数"))

End Sub

Private Sub Command2_Click()

Select Case Combo1.ListIndex

Case 0

MsgBox Str(x) & f1(x)

Case 1

MsgBox Str(x) & f2(x)

Case Else

Exit Sub

End Select

End Sub

Private Function f1(ByVal x As Integer) As String

If x \ 2 <> x / 2 Then

f1 = "是奇数"

Else

f1 = "是偶数"

End If

End Function

Private Function f2(ByVal x As Integer) As String

If x Mod 7 = 0 Then

f2 = "能被7整除"

Else

f2 = "不能被7整除"

End If

End Function

Private Flag As Boolean

Private Sub Form_Click()

If Flag Then

Shape1.Top = Shape2.Top

Shape1.Left = Shape2.Left

Flag = Not (Flag)

Else

Shape1.Top = Shape2.Top + Shape2.Height - Shape1.Height

Shape1.Left = Shape2.Left + Shape2.Width - Shape1.Width

Flag = Not (Flag)

End If

End Sub

Private Sub Form_Load()

Flag = True

End Sub

Dim a(10) As Integer

Dim b(10) As Integer

Dim c(10) As Integer

Private Sub Command1_Click()

Open App.Path & "\dataA.txt" For Input As #1

Open App.Path & "\dataB.txt" For Input As #2

For i = 0 To 9

Input #1, a(i)

Input #2, b(i)

Next

Close #1, #2

End Sub

Private Sub find(x() As Integer, t As TextBox)

Max = x(1)

For i = 2 To UBound(x)

If x(i) > Max Then

Max = x(i)

End If

Next

t.Text = Max

End Sub

Private Sub Command2_Click()

For i = 1 To UBound(a)

c(i) = a(i) + b(i)

Next

Open App.Path & "\out51.txt" For Output As #1

For i = 0 To 9

Print #1, c(i)

Next

Close #1

End Sub

Private Sub Command3_Click()

Call find(a, Text1)

Call find(c, Text2)

Open App.Path & "\out52.txt" For Output As #1

Print #1, Text1.Text, Text2.Text

Close #1

End Sub

展开阅读全文

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值