• 2022-05-26
    下列程序的功能是:将数据1,2,..,8写入顺序文件Num. txt中请补充完整。 Private Sub Form_Click ( ) Dim i As Integer Open "Num. txt" For Output As #1 For i = 1 To 8 【13】 Next Close #1 End Sub
  • Print #1,i

    内容

    • 0

      下列这个Sub过程的功能是统计字符串中“a”的个数,请在空白处填上合适的代码,将程序补充完整。 Private Sub numCoun() Dim num As Integer s$="software And hardware" num=Len(s$) For i=1 To num b$=______ Ifb$="a"Then x=x+1 Next i Print "x=";x End Sub

    • 1

      下列这个Sub过程的功能是:统计字符串中“a”的个数,请在空白处填上合适的代码,将程序补充完整。 Private Sub numCount() Dim num As Integer S$="software And hardware" num=Len(s$) For i=1 To num b$=______ Ifb$="a" Then x=x+1 Next i Print "x=";x End Sub

    • 2

      运行下面的程序,第二行显示结果是___________。 Private Sub Form_Click() Dim A As Integer Dim i As Integer A = 5 For i = 1 To 9 Call sub1(i, A) Print i, A Next i End Sub Private Sub sub1(x As Integer, y As Integer) Static N As Integer Dim I As Integer For I = 3 To 1 Step -1 N = N + x x = x + 2 Next I y = y + N End Sub

    • 3

      下列代码执行的结果是( )。 Private Sub Form_Click() Dim a(5) Dim i as Integer For i = 1 To 5 <br/>a(i) = i + 2 Next i Print a(4) End Sub A: 6 B: 8 C: 24 D: 2

    • 4

      下面程序的功能是对统计所输入的10个数据中奇数和偶数的个数,为了实现相应功能请将如下代码补充完整。 Private Sub P9() Dim num As Integer,a As Integer,b As Integer,i As Integer For i=1 To 10 num = InputBox("请输入数据:","输入") If ________ Then ________ Else b = b + 1 End If Next i MsgBox("运行结果:偶数个数=" & Str(a) & ",奇数个数=" & Str(b)) End Sub