【VB开源代码栏目提醒】:本文主要为网学会员提供“vb程序阅读题 - 编程语言”,希望对需要vb程序阅读题 - 编程语言网友有所帮助,学习一下!
一、 程序阅读题每题 5 分,共 15 分 aax 1、 写出点击按钮 command1 后,显示在窗体上的内容。
xx3 private sub command1_click Loop dim kj as integer End Sub for k1 to 5 print space5-k 4、 写出点击窗体后,显示在窗体上的内容。
for j1 to k2-1 Function chgbyval m as byte n as byte as byte print chrasc“C”j nn2 next j mmn print Chg2m next k End function end sub Private sub form_click Dim k as byte j as byte 2、 写出点击窗体后,显示在窗体上的内容。
j1 Private sub form_click For k1 to 3 Call printdlt5 Print kj End sub Print chgkj Private Sub printdltn as integer next k Dim k as integer End sub for k1 to n print spacen-k 5、 写出单击窗体后,显示在窗体上的内容。
for j1 to 2k-1 Private Function chga As Integerbyval b as integer As print “” Integer next j Dim n as integer print bb1 next k For n0 to 2 for k1 to n-1 aab print spacek Next n for j1 to 2n-k-1 Chga print “” End Function next j Private Sub form_click print Dim a as integerb as integer z as integer next k Dim n as integer end sub a1:b1 for n1 to 3 3、 写出程序运行时连续三次单击 Command1 后,a1.dat zchgab 文件的最终结果 print “n” n ”z”z Dim a As Integer y As Integer next n Private Sub Form_Load End Sub Open ”c:al.dat” For Output As 1 Close 1 6、 写出程序的执行结果 End Sub private sub form_click Private Sub Command1_Click dim x as string Open ”c:a1.dat” For Append As 1 dim I as integern as integer Call aa5 xquotABCDEFGquot yya nlenx Print 1”y” y ”a” a : Close 1 For in to 1 step -2 End Sub xxmidxi1 Sub aai As Integer Print midxi1 x1 Next i Do until xgti Print Print x 第三次输入 3,第四次输入 4,窗体上显示的结果。
end sub Private Sub Form_Click7、 写出点击三次窗体后,文件“a1.txt”中的内容。
Dim x As Integer Private Sub form_click Static s As Integer Static k As Integer x ValInputBoxquot请输入一个正整数quot Dim j As Integer If x Mod 2 0 Then kk1 ssx Open quotc:a1.txtquot For Append As 1 Else For j 1 To k ssx Print 1 j End If Next j Me.Print quotsquot Strs Print 1 End Sub Close 1 End Sub 11、写出单击窗体后,c:data2.dat 文件中的数据。
Private Sub Form_click8、 写出点击窗体后,文件”c:result.txt”中的内容。
Open quotc:data1.datquot For Input As 1 Private sub form_click Call outputdataquotc:data2.datquot Dim s as stringkj as integer t as string Close Dim a1 to 5 as string End Sub s”basic” Private Sub outputdatafilename As String For k1 to 5 Dim a As String b As Integer akmidsk1 Open filename For Output As 2 Next k Do While Not EOF1 Open “c:result.txt” for output as 1 Input 1 a b For k1 to 4 If Lefta 1 quot李quot And b gt 60 Then For jk1 to 5 Print 2 a b If akgtaj then End If tak:akaj:ajt Loop End if End Sub Next j 已知在 c:data1.dat 文件中数据如下: Print 1”a”trimstrk”” 张寇78李琳80王澜56司马38李晓90刘召50李 Write 1ak 名45 Next k Print 1”a5” 12、设输入的数据分别为 14,3,125,21 时,标签框 Write 1a5 Label1.Caption 的值分别是多少 Write 1s Private Sub Form_ Click Close 1 Dim a As Integer End sub aVal InputBox “请输入数据” 100 Select Case a Mod 59、 写出单击窗体后程序的执行结果 Case Is lt4 private sub form_click wa10 for I10 to 1 step –1 Case Islt2 print Ispace2 wa2 if I mod 30 then Case Else print wa-10 ii-1 End Select end if Label1.Caption“w”amp Strw next i End Sub end sub 13、写出 a1.dat 文件的最终结果10、写出单击窗体四次,第一次输入 1,第二次输入 2, Private Sub Form_Click Dim f1 As Integer Dim f2 As Integer f3 As Integer 16、写出程序运行时单击窗体后,Form1 上输出的结果 Open “c:a1.dat” For Output As1 Private Sub Form_Click f12 : f23 Cls Print 1”NO”3f1 For i 1 To 8 Print 1”NO”4 f2 If i lt 2 Then For i 5 To 7 Print Tab10 quotVVVquot f3 f1f2 Else Print 1”NO.”If3 Print Tab3 i f1f2 For j 1 To 17 - 2 i f2f3 Print quotVquot Next I Next j Close 1 Print End Sub End If Next i14、写出运行以下程序后 Form1 上的输出结果 End Sub 写出将标记有①和②的两条语句对调后,重新运行 程序时 Form1 上的输出结果 17、写出程序执行的结果 Private Sub Command1_Click Option Base 1 Const n6 Private Sub Form_Click Dim xxn As Integer Dim a5 5 As Integer Form1.Cls Dim i As Integer j As Integer For i1 To n For i 1 To 5 xxiii For j 1 To 5 Next i If j lt i Then Call fchangexxn ai j 1 For i1 To n End If Form1.print xxi Print ai j quot quot Next i Next j End Sub print Sub fchangea As Integerm Next i For i1 To m/2 End sub tai aiam-i1 ‘① 18、写出程序执行的结果 am-i1t ‘② Private Sub form_click Next i Dim S As String End Sub Dim k As Integer n As Integer S quotABCDEquot15、程序运行时单击 Command1 后,分别写出文本框 n LenS Text1、Text2 和 Text3 的 Text 值。
For k n To 1 Step -1 Private Sub Command1_Click S S MidS k 1 n 0: x 1: y 0 Print Tabn - k 1 Do While x lt 20 Print MidS n - k 1 1 nn1 Next k yxy Print RightS n x x x 1 End Sub Loop Text1.Text quotnquot amp Strn 19、 写出往文本框顺序键入”H4E3”后,显示在窗体上的 Text2.Text quotxquot amp Strx 内容。
Text3.Text quotyquot amp Stry Private Sub Text1_Change End Sub Print Text1.Text End Sub 22、写出程序运行时单击窗体后窗体上的输出结果。
Private Sub Text1_KeyPressKeyAscii As Integer Private Sub Form_Click If KeyAscii gt Ascquot0quot And KeyAscii lt Dim a As Integer b As IntegerAscquot9quot Then a1 Print ChrKeyAscii Text1.Text b2 Call Proc1ab End If Print ab End Sub End Sub Private Sub Proc1c As Integerd As Integer 20、控件 HScroll1 的属性设置如下: Dim a As Integerb As Integer HScroll1.Min1 HScroll1.Max9 HScroll1.Value1 cab HScroll1.Smallchange2 HScroll1.Largechange4 da-b 下面程序运行时,4 次单击滚动条右端箭头,写出各次单 Print cd 击时 Text1 上的显示结果。
End Sub Dim y As Single Private Function f1x2 As Integer As Single 23、请写出程序的执行结果 Static x1 As Integer dim a as integerb as integer f1 0 dim n as integerc as integer For i x1 To x2 a12 : b9 : c11 f1 f1 i if agtb then nb : ba : an Next i if agtc then nc : ca : an x1
上一篇:
VB6 0教程
下一篇:
关于大学英语教学