教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 文库大全 > 实用文档 >

全国计算机二级第八套上机考试试题~~~

来源:网络收集 时间:2026-07-06
导读: Private x As Integer Private Sub Command1_Click() x = V al(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 Su

Private x As Integer

Private Sub Command1_Click()

x = V al(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(ByV al x As Integer) As String If x \ 2 <> x / 2 Then

f1 = "是奇数"

Else

f1 = "是偶数"

End If

End Function

Private Function f2(ByV al 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

全国计算机二级第八套上机考试试题~~~.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wenku/1110090.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)