ImageVerifierCode 换一换
格式:DOCX , 页数:35 ,大小:295.22KB ,
资源ID:5920258      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/5920258.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(计算机二级所有大题.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

计算机二级所有大题.docx

1、计算机二级所有大题1Sub ReadData2( Open App.Path & & datain2.txt For Input As #1 For i = 1 To 2 Input #1, Arr2(i) Next i Close #1 End SubSub WriteData(Filename As String, Num As Integer) Open App.Path & & Filename For Output As #1 Print #1, Num Close #1 End SubPrivate Sub Command1_Click( End SubPrivate Sub c1

2、_Click() Call ReadData1 Call ReadData2 End SubPrivate Sub c2_Click() Dim arr3(20) As Integer, sum As Integer sum = 0For i = 1 To 20 arr3(i) = Arr1(i) - Arr2(i) sum = sum + arr3(i) Next iPrint sumCall WriteData(dataout.txt, sum)End Sub2 Dim stepy As Integer 纵向移动增量Dim stepx As Integer 横向移动增量Const LEFT

3、_BUTTON = 1Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) Dim x0 As Integer, y0 As Integer, a As Single, radius As Integer radius = Shape1.Width / 2 圆的半径 If Button = LEFT_BUTTON Then x0 = Shape1.Left + radius 圆心的x坐标 y0 = Shape1.Top + radius 圆心的y坐标 If x = x0

4、 Then stepy = Sgn(y - y0) * 50 stepx = 0 Else a = (y - y0) / (x - x0) 斜率 stepx = Sgn(x - x0) * 50 stepy = a * stepx If Abs(stepy) Abs(stepx) Then stepy = Sgn(y - y0) * 50 stepx = stepy / a End If End If Timer1.Enabled = True Else Timer1.Enabled = False End IfEnd SubPrivate Sub Timer1_Timer() Shape1.

5、Move Shape1.Left + stepx, Shape1.Top + stepyEnd Sub3)Private Sub Command2_Click()需要考生编写的内容l = Val(Text1.Text)Select Case l Case Is = 2000 t = 0.9 Case Is = 1500 t = 0.92 Case Is = 1000 t = 0.95 Case Is = 500 t = 0.98 Case Else t = 1End Selecty = Int(l * t * 0.3)Text2.Text = Str(y)End SubPrivate Sub

6、List1_Click()需要考生编写的内容 Text1.Text = a(List1.ListIndex + 1)End Sub4Private Sub Command2_Click() 要求考生编写的程序Dim i As Integer, p(5)For i = 1 To 5 p(i) = getmark(i)Next igj = p(1)j = 1For i = 1 To 5 If p(i) gj Then gj = p(i) j = i End IfNext iText2.Text = athlete(j)Text3.Text = Str(gj)End Sub5参考代码:Dim i A

7、s IntegerDim n As Integern = Val(Text1.Text)3If n Mod 2 0 Then MsgBox 请输入偶数! Exit SubEnd IfFor i = 3 To n / 2 If IsPrime(i) And IsPrime(n - i) Then Label1.Caption = i Label2.Caption = n - i Exit For End IfNext6Private Sub Command2_Click()需考生编写maxl = 0c = 0Sum = 0t = For i = 1 To Len(s) ch = Mid(s, i

8、, 1) If ch Then t = t + ch Else If Len(t) maxl Then maxl = Len(t) End If Sum = Sum + Len(t) c = c + 1 End IfNext iText1.Text = Str(CInt(Sum / c)Text2.Text = Str(maxl)End sub7 Private Sub Command2_Click()考生编写程序开始=For i = 1 To 30 c(i) = a(i) c(30 + i) = b(i) Next iFor i = 1 To 59 For j = 1 To 60 - i I

9、f c(j) c(j + 1) Then t = c(j) c(j) = c(j + 1) c(j + 1) = t End If Next jNext i=考生编写程序结束8 Private Sub Command2_Click() 考生编写Dim a(26) As IntegerFor i = 1 To Len(s) ch = Mid(s, i, 1) If ch = a And ch = A And ch Max Then Max = a(i) j = i End IfNext iText1.Text = Chr(Asc(a) + j - 1)Text2.Text = Str(Max)E

10、nd Sub9 以下Function 过程用于判断字符串是否为回文Function foundhuiwen(p As String) 考生编写For i = 1 To Int(Len(p) / 2) If Mid(p, i, 1) Mid(p, Len(p) - i + 1, 1) Then Exit Function End IfNext ifoundhuiwen = TrueEnd Function10Private Sub Command2_Click() 考生需要编写的程序s = Text1.TextText1.Text = For i = 1 To Len(s) ch = Mid(s

11、, i, 1) If ch = E Or ch = N Or ch = T Then ch = LCase(ch) ElseIf ch = e Or ch = n Or ch = t Then ch = UCase(ch) End If Text1.Text = Text1.Text + chNext iEnd Sub11Private Sub Command1_Click() Text4 = a = Val(Text1) b = Val(Text2) n = Val(Text3) Text4 = Text4 & a & & b k = 2 Do While k n c = a * b k =

12、 k + 1 If c 10 Then Text4 = Text4 & & c a = b b = c Else d = c 10 Text4 = Text4 & & d a = d k = k + 1 If k = n Then d = c Mod 10 Text4 = Text4 & & d b = d End If End If LoopEnd Sub12Option Base 1Private Sub Form_Click() Const N = 5 Const M = 5 Dim mat(N, M) Dim i, j Open App.Path & & datain.txt For

13、Input As #1 For i = 1 To N For j = 1 To M Input #1, mat(i, j) Next j Next i Close #1 Print Print 初始矩阵为: Print For i = 1 To N For j = 1 To M Print Tab(5 * j); mat(i, j); Next j Print Next i Print: Print Print 右上 - 左下对角线上的数为: For i = 1 To N For j = 1 To M If i + j = 6 Then Print Tab(5 * i); mat(i, j);

14、 End If Next j Next iEnd Sub13Private Sub Command2_Click()考生编写For i = 1 To 12 Sum = 0 For j = 1 To 10 Sum = Sum + a(i, j) Next j s(i) = Int(Sum / 10)Next iEnd Sub14Private Sub Command1_Click()=以下考生编写程序开始=a59 = 0a69 = 0a79 = 0a89 = 0a99 = 0For i = 1 To n Select Case arr(i) Case Is 60 a59 = a59 + 1 Ca

15、se Is 70 a69 = a69 + 1 Case Is 80 a79 = a79 + 1 Case Is 0 Then MsgBox 第 & (3 - Text2.Text) & 次口令错误,请重新输入 Else MsgBox 3次输入错误,请退出 Text1.Enabled = False End If End IfEnd Sub17Private Sub Command2_Click() Dim b(100) As Integer num = 0 If Len(Text1.Text) = 0 Then MsgBox 请先执行“读数据”功能! Else 考生编写(功能:生成 b 数组,

16、且按从小到大顺序排序) 注意:请务必将数组 b 的元素个数存入变量 num 中 For i = 1 To 100 If a(i) Mod 3 = 0 Then num = num + 1 b(num) = a(i) End If Next i For i = 1 To num - 1 For j = 1 To num - i If b(j) b(j + 1) Then t = b(j) b(j) = b(j + 1) b(j + 1) = t End If Next jNext i 以下程序段将已排序的 b 数组显示在Text2中 For i = 1 To num Text2.Text = T

17、ext2.Text + Str(b(i) + Space(2) Next i End IfEnd Sub18Option Base 1Dim Arr(100) As IntegerDim sum As IntegerSub ReadData() Open App.Path & & datain1.txt For Input As #1 For i = 1 To 100 Input #1, Arr(i) Next i Close #1End SubSub WriteData(Filename As String, Num As Integer) Open App.Path & & Filenam

18、e For Output As #1 Print #1, Num Close #1End SubPrivate Sub calc_Click()Text1.Text = For i = 1 To 100 If Arr(i) Mod 3 = 0 Then Text1.Text = Text1.Text + Str(Arr(i) + Space(2) sum = sum + Arr(i) End IfNext iPrint sumEnd SubPrivate Sub read_Click()Call ReadDataEnd SubPrivate Sub save_Click()Call Write

19、Data(dataout.txt, sum)End Sub19Private Function isprime(a As Integer) As Boolean Dim flag As Boolean flag = True b% = 2 Do While b% = 15000 a = a + 1 If isprime(a) Then Text1.Text = Str(a) Exit Do End IfLoopEnd SubPrivate Sub C2_Click()Open App.Path + out5.txt For Output As #1Print #1, Text1.TextClo

20、se #1End Sub20 Private Sub Command2_Click()=算法:1)令i指向第1个数,j指向最后1个数,并先暂存最后一个数;2)检查第i个数是否为偶数,若不是,再检查下一个,直到第i个是 偶数,则把此偶数放到第j个位置,j向前移1个位置;3)检查第j个数是否为奇数,若不是,再检查前一个,直到第j个是 奇数,则把此奇数放到第i个位置,i向后移1个位置;4)重复2)、3),直到i=j5)把开始暂存的数放到i的位置= Dim i%, j%, temp%, flag As Boolean i = 0 j = 9 temp = Text1(j) flag = True Wh

21、ile (i = 60 Then jg = jg + 1 Else bjg = bjg + 1 End IfNext iAvg = Sum / nText1.Text = Str(n)Text2.Text = Str(Avg)Text3.Text = Str(bjg)Text4.Text = Str(jg)=考生编写程序结束=End Sub22Option Base 1Private Sub Command1_Click()Dim s(35) As Long s(1) = 1 s(2) = 1 For i = 3 To 35 s(i) = s(i - 1) + s(i - 2) Next iIf Op1(0).Value Then Text1.Text = s(30) ElseIf Op1(1).Value Then Text1.Text = s(33) Else Text1.Text = s(35)End If End Su

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1