1-40上机模拟试题答案.doc_第1页
1-40上机模拟试题答案.doc_第2页
1-40上机模拟试题答案.doc_第3页
1-40上机模拟试题答案.doc_第4页
1-40上机模拟试题答案.doc_第5页
已阅读5页,还剩18页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

140套模拟试题的简单应用和综合应用的答案一:2(1): index n n+2 n f12(2): s s,s1 str(n) 3:Private Sub C1_Click() Dim x As Integer x = 17999 Do While x 3:Dim i As Integer, j As Integer, n As Integer For i = 1 To 7 For j = 1 To 7 If i = 1 Or i = 7 Or j = 1 Or j = 7 Then Sum = Sum + a(i, j) If a(i, j) Mod 7 = 0 Then n = n + 1 End If Next j Next i lblFirst.Caption = Str(n)lblSecond.Caption = Str(Sum)三:2(1): or num 2(2):Avg is=85 is=60 end select n-13:Dim b(20) As Single, i As Integer, j As Integer Dim max As Integer For i = 1 To 20 For j = 1 To 5 b(i) = b(i) + a(i, j) Next j b(i) = b(i) / 5 Next i max = b(1) For i = 2 To 20 If max b(j) Then t = b(i) b(i) = b(j) b(j) = t End If Next j Next i五:2(1): x b(i) Then min = b(i) Next i Label3.Caption = Str(n) Label4.Caption = Str(min)八:2(1):len asc b 2 x(i).caption2(2):la.listcount la la3: eof(1) str(a(i)Dim i As Integer, j As Integer, t As IntegerFor i = 1 To 9 For j = i + 1 To 10 If a(i) a(j) Then t = a(i) a(i) = a(j) a(j) = t End If Next jNext I九:2(1):command1 label1 control label2.caption2(2):false true 8 03:b(i) = a(i, 1)c(i) = 1For j = 2 To 5 If b(i) a(i, j) Then min = a(i, j) Next j s = s + min Next i s = s /20 Text2.Text = Str(s)十一:2(1):Dim b(100) As Integer, n As IntegerDim i As Integer, max As Integer, min As IntegerFor i = 1 To 100If isnarc(a(i) Thenn = n + 1b(n) = a(i)End IfNext imax = b(1)min = b(1)For i = 2 To nIf max b(i) Then min = b(i)Next iText1.Text = Str(max)Text2.Text = Str(min)Dim b(100) As Integer, i As Integer, max As Integer, min As Integer, n As Integern = 1For i = 1 To 100If isnarc(a(i) = True Thenb(n) = a(i)n = n + 1End IfNext I max = b(1): min = b(1)For i = 2 To n-1If max b(i) Then min = b(i)Next iText1.Text = maxText2.Text = min2(2):Dim n As Integer, i As Integer Dim s As Long n = Val(cb1.Text) For i = 1 To 5000 If i Mod n = 0 Then s = s + i Next i Text1.Text = Str(s)3:Dim s1 As Integer, s2 As Integer, s3 As Integer Dim i As Integer, max As Integer, a As String For i = 1 To Len(s) a = Mid(s, i, 1) If a = Or i = Len(s) Then s2 = s2 + 1 If s3 max Then max = s3 s3 = 0 Else s1 = s1 + 1 s3 = s3 + 1 End If Next i Text1.Text = CInt(s1 / s2) Text2.Text = max十二:2(1):1 text1.text command1.enabled=true2(2):List1.List(List1.ListCount - 2) b c3:Dim b(5) As Integer, c(5) As SingleDim i As Integer, j As Integer, n As IntegerFor i = 1 To 5 n = 0 For j = 1 To 40 If a(i, j) = A And m = Z Then n = Asc(m) - Asc(A) + 1 a(n) = a(n) + 1 End If Next i max = a(1) For i = 2 To 26 If max a(i) Then max = a(i) Next i For i = 1 To 26 If a(i) = max Then Text1.Text = Text1.Text & Chr(Asc(A) + i - 1) End If Next i Text2.Text = Str(max)十四:2(1):true erval=2000 a 02(2):list1.clear 0 list1.list(k) k text2.text3:Dim i As Integer, j As Integer Dim max As Integer, avg As Single, n As Integer For i = 1 To 5 max = 0: avg = 0: n = 0 For j = 1 To 40 If a(i, j) Mod 2 = 0 Then If max a(i, j) Then max = a(i, j) End If If a(i, j) Mod 2 = 1 Then n = n + 1 avg = avg + a(i, j) End If Next j avg = Int(avg / n * 100 + 0.5) / 100 Label1(i - 1).Caption = Str(max) Text2(i - 1).Text = Str(avg) Next I十五:2(1):index true false 60 i-12(2):Dim i As Integer, j As Integer, max As Integer Dim f As Integer For i = 1 To 20 max = a(i, 1) For j = 1 To 5 If max max Then max = s1: m2 = s2 s1 = 0 s2 = Else s1 = s1 + 1 s2 = s2 & a End IfNext iText1.Text = maxText2.Text = m2十七:2(1):text1.text list1.listcount-1 text1.text i2(2):Lbound Ubound Finish i-1 3:Dim s As Integer 通用声明Private Sub read_Click() ReadDataEnd SubPrivate Sub calc_Click() Dim i As Integer For i = 1 To 100 If Arr(i) = 50 Then Text1.Text = Text1.Text & Str(Arr(i) s = s + Arr(i) End If Next i Print sEnd SubPrivate Sub save_Click() Call WriteData(dataout.txt, s)End Sub十八:2(1):0 2 value caption2(2):Private Sub cb1_Click() l1.FontSize = cb1.TextEnd SubPrivate Sub Cb2_Click() l1.FontName = cb2.TextEnd Sub3:Private Sub C1_Click() Dim i As Integer, x As Integer x = 15000 Do x = x + 1 If isprime(x) Then Exit Do Loop Text1.Text = Str(x)End SubPrivate Sub C2_Click() Open App.Path & out5.txt For Output As #1 Print #1, Text1.Text Close 1End Sub十九:2(1):1001 0 arrn(i)500 sum+arrn(i)2(2):Dim i As Integer, s As Long For i = 0 To 100 If i Mod 7 0 Then s = s + i Next i Fun = s3:mat(n,m) as integer for input input#1,mat(i,j)0 sum=sum+mat(3,j)二十:2(1):1001 0 sum+arrn(i) sum/202(2):Dim i As Integer For i = 0 To 200 If i Mod 3 = 0 Then Fun = Fun + i Next I3:Dim i As Integer, j As Integer For i = 1 To 12 For j = 1 To 10 s(i) = s(i) + a(i, j) Next j s(i) = s(i) / 10 Next I21:2(1):Private Sub c1_Click() Text1.PasswordChar = End SubPrivate Sub c2_Click() Text1.PasswordChar = ?End SubPrivate Sub c3_Click() Text2.Text = Text1.TextEnd SubPrivate Sub Form_Load() Text1.PasswordChar = *End Sub2(2):Private Sub p1_Click() cd1.ShowOpenEnd Sub3:Dim i As Integer, m As String For i = 1 To Len(p) m = Mid(p, i, 1) & m Next i If p = m Then foundhuiwen = True22:2(1):index a2(2):Private Sub c1_Click() If op1.Value Then If op3.Value Then Text1.Text = 我是 & op1.Caption & op3.Caption ElseIf op4.Value Then Text1.Text = 我是 & op1.Caption & op4.Caption End If ElseIf op2.Value Then If op3.Value Then Text1.Text = 我是 & op2.Caption & op3.Caption ElseIf op4.Value Then Text1.Text = 我是 & op2.Caption & op4.Caption End If End IfEnd Sub3:同第1套模拟试题综合应用23:1(2):计时器属性:enabled:false interval:1000Private Sub Command1_Click() Timer1.Enabled = TrueEnd SubPrivate Sub Command2_Click() Timer1.Enabled = FalseEnd SubPrivate Sub Command3_Click() sub1End SubPrivate Sub Timer1_Timer() Text1.Text = Text1.Text + 1End Sub2(1):AddItem L1.ListIndex2(2):Private Sub c1_Click() If op1.Value Then Text1.Text = 需要1小时 ElseIf op2.Value Then Text1.Text = 需要10小时 ElseIf op3.Value Then Text1.Text = 需要15小时 End IfEnd Sub3:Dim i As Integer, f As Integer, n As Integer Dim b As Integer, c As Integer, d As Integer For i = 1 To 100 b = a(i) 100 c = a(i) 10 Mod 10 d = a(i) Mod 10 If a(i) = b 3 + c 3 + d 3 Then n = n + 1 f = f + a(i) End If Next i Text1.Text = Fix(f / n)24:2(1):1001 min minarrN(i)2(2):Dim i As Integer, n As Integer For i = 0 To 1000 If i Mod 7 0 Then n = n + 1 Next i Fun = n3:读入数据Private Sub c1_Click() ReadData1 ReadData2End Sub计算Private Sub c2_Click() Dim i As Integer, s As Integer Dim arr3(20) As Integer For i = 1 To 20 arr3(i) = Arr1(i) - Arr2(i) s = s + arr3(i) Next i Print s Call WriteData(dataout.txt, s)End Sub25:2(1):Private Sub Option1_Click() Text1.Alignment = 0End SubPrivate Sub Option2_Click() Text1.Alignment = 2End SubPrivate Sub Option3_Click() Text1.Alignment = 1End SubPrivate Sub Option4_Click() Text1.FontName = 宋体End SubPrivate Sub Option5_Click() Text1.FontName = 黑体End Sub2(2):Timer1.Enabled = False 30 x0 y2 b3:a(n,1) 7 a(n,8)Dim i As Integer, max As Single, j As Integer For i = 1 To 5 If max getmark(i) Then max = getmark(i) j = i End If Next i Text2.Text = athlete(j) Text3.Text = max26:2(1):If op1.Value Then Text1.Text = 我是 & op1.Caption If op2.Value Then Text1.Text = 我是 & op2.Caption If ch1.Value = 1 Then Text1.Text = 我的爱好是 & ch1.Caption If ch2.Value = 1 Then Text1.Text = 我的爱好是 & ch2.Caption If ch1.Value = 1 And ch2.Value = 1 Then Text1.Text = 我的爱好是 & _ ch1.Caption & ch2.Caption2(2):0 1000 list1.list(i)3:通用声明Dim n1 As Integer, n2 As Integer, n3 As IntegerDim n4 As Integer, n5 As Integer, n6 As Integer读数Private Sub Command1_Click() Dim m As String Open app.path & in5.txt For Input As 1 m = Input(LOF(1), 1) Close 1 Text1.Text = mEnd Sub统计Private Sub Command2_Click() Dim i As Integer, s As String, c As String s = Text1.Text For i = 1 To Len(s) c = UCase(Mid(s, i, 1) If c = I Then n1 = n1 + 1 ElseIf c = J Then n2 = n2 + 1 ElseIf c = K Then n3 = n3 + 1 ElseIf c = L Then n4 = n4 + 1 ElseIf c = M Then n5 = n5 + 1 ElseIf c = N Then n6 = n6 + 1 End If Next i End Sub存盘Private Sub Command3_Click() Open App.Path & out5.txt For Output As 1 Print #1, n1; n2; n3; n4; n5; n6 Close 1End Sub27:2(1):Private Sub Command1_Click() If Option1.Value Then Text1.Text = List1.Text & Option1.Caption Else Text1.Text = List1.Text & Option2.Caption End IfEnd Sub2(2):0 isum+j 12503:通用声明Private Type studinfo name As String * 8 sex As String * 4 age As IntegerEnd Type显示Private Sub Command1_Click() Dim std As studinfo, i As Integer Open App.Path & in5.txt For Random As 1 Len = Len(std) For i = 1 To 5 Get #1, i, std Text1.Text = Text1.Text & & std.sex & std.age & vbCrLf Next i Close 1End Sub保存Private Sub Command2_Click() Open App.Path & out5.txt For Output As 1 Print #1, Text1.Text Close 1End Sub282(1):Dim i As Integer, max As Integer, min As Integer Dim j As Integer, b(100) As Integer For i = 1 To 100 If isnarc(a(i) Then j = j + 1 b(j) = a(i) End If Next i max = b(1): min = b(1) For i = 2 To j If max b(i) Then min = b(i) Next i Text1.Text = max Text2.Text = min2(2):Private Sub c1_Click() Dim i As Integer, s As Long, n As Integer n = cb1.Text For i = 1 To 5000 If i Mod n = 0 Then s = s + i Next i Text1.Text = sEnd Sub3: a(k) chDim i As Integer, j As Integer, t As Integer For i = 1 To 49 For j = i + 1 To 50 If a(i) a(j) Then t = a(i) a(i) = a(j) a(j) = t End If Next j Next i For i = 1 To 50 Text2.Text = Text2.Text & Str(a(i) Next I29:2(1):index true form1.width 02(2):Lbound Ubound a a(i) arr23:Dim s As Integer 通用声明Private Sub read_Click() ReadDataEnd SubPrivate Sub calc_Click() Dim i As Integer For i = 1 To 100 If i Mod 2 = 0 Then s = s + Arr(i) Text1.Text = Text1.Text & Str(Arr(i) End If Next i Print sEnd SubPrivate Sub save_Click() WriteData dataout.txt, sEnd Sub30:2(1):form1 form1.visible2(2):Private Sub op1_Click() Dim m As String m = Text1.Text Text1.Text = Text2.Text Text2.Text = m Text3.Text = 交换成功 op1.Visible = FalseEnd SubPrivate Sub op2_Click() Text3.Text = Text1.Text & Text2.TextEnd Sub3:Dim x As Integer, i As Integer Dim n As Integer x = Val(Text1.Text) For i = x - 1 To 2 Step -1 If IsPrime(i) Then Label1(n).Caption = i n = n + 1 If n = 3 Then Exit For End If Next I31:2(1):listindex f1(x) f2(x) as string 02(2):Boolean shape1.height shape1.width3:Private Sub find(x() As Integer, t As TextBox)=以下为考生编写的程序= Dim i As Integer, a As Integer a = x(LBound(x) For i = LBound(x) To UBound(x) If a Abs(a(i) - avg) Then min = Abs(a(i) - avg) Text1.Text = a(i) End If Next I352(1):0 i opt2(2):val(inputbox(“请输入月份”) n0 and n13 m3:Recnum+1 Recnum,pers =”Y” lof(1)/len(pers) i,pers36:2(1):Dim a As Integer, b As Integer, c As Integer Dim m As String, i As Integer For i = 1 To Len(s) m = Mid(s, i, 1) Select Case m Case A To Z a = a + 1 Case a To z b = b + 1 Case c = c + 1 End Select Next i If Option1.Value Then Text1.Text = a ElseIf Option2.Value Then Text1.Text = b Else Text1.Text = c End If2(2): true index m3:Dim a As Integer, b As Integer a = Val(Text1.Text) b = a Do If isprime(a) Then Text2.Text = a Exit Do End If a = a - 1 Loop Do b = b + 1 If isprime(b) Then Text3.Text = b Exit Do End If Loop37:2(1):3 k 02(2):combo1.listindex 3,6 tmpstr3:Dim i As Integer, n As Integer n = Val(Text1.Text) a(1) = 1 a(2) = 1 For i = 3 To n a(i) = a(i - 1) + a(i - 2) + 1 Next i Text2.Text = a(n)382

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论