上机模拟试题答案

1.9通用对话框与文件

9.1 filter showopen cd1.filename close

9.2 file1.path=dir1.path

Dir1.path=drive1.drive

File1.filename

9.3 2 action a ucase 2

9.4 input a(i) i>n n a(j+1) ubound(a)

9.5 input text1.sellength a(n)+1 max_n

Dim i As Integer, n As Integer

Dim s As Long

For i = 1 To 100

If a(i) = Int(aqr(a(i))) ^ 2 Then

s = s + a(i)

n = n + 1

End If

Next i

Text1.Text = Fix(s / n)

9.7 mat(n,m) as integer for input input#1,mat(i,j) i+j=6

1.10 综合应用

10.1 2 commondialog1.filename s

Dim s As String, c As String

s = Text1.Text

For i = 1 To Len(s)

c = Mid(s, i, 1)

If c = "E" Then

Mid(s, i, 1) = "e"

ElseIf c = "e" Then

Mid(s, i, 1) = "E"

End If

If c = "N" Then

Mid(s, i, 1) = "n"

ElseIf c = "n" Then

Mid(s, i, 1) = "N"

End If

If c = "T" Then

Mid(s, i, 1) = "t"

ElseIf c = "t" Then

Mid(s, i, 1) = "T"

End If

Next i

Text1.Text = s

相关推荐
相关主题
热门推荐