1、2012 年 12 月 29 日 VB- 编程题第一题(1)Private Sub Command1_Click() 不得删除本行注释Dim year%year = Val(Trim(Text1.Text)If year Mod 4 = 0 And year Mod 100 = “0“ And Mid(Text1.Text, i, 1) max Then max = A(i)If A(i) min Then min = A(i)Next iText2.Text = maxText3.Text = minEnd Sub(4)Private Sub Command1_Click()不得删改本行注释
2、Dim a$Text1.Text = “Open App.path & ” & “pdzm.txt “ For Input As #1Do While Not EOF(1)Line Input #1, aText1.Text = Text1.Text & aLoopClose #1End SubPrivate Sub Command2_Click()不得删改本行注释Dim n$, i%, count%n = Text2.TextFor i = 1 To Len(Text1.Text)If UCase(Mid(Text1.Text, i, 1) = UCase(Text2.Text) Then
3、count = count + 1Next iText3.Text = countEnd Sub(5)Private Sub Command1_Click()不得删改本行注释Dim i%, num%Open App.path & ” & “ input02.txt “ For Input As #1For i = 1 To 20Input #1, numa(i) = numText1.Text = Text1.Text & a(i) & “ “Next iClose #1End SubPrivate Sub Command2_Click()不得删改本行注释Dim sum%, i%sum = 0For i = 1 To 20sum = sum + a(i)Next iText2.Text = sumEnd Sub