题型:综合题 题类:常考题 难易度:普通
浙江省台州市黄岩第二高级中学2019-2020学年高二下学期信息技术返校考试试卷
编写VB程序,功能如下:程序运行时,在文本框Text1中输入序列,单击“计算”按钮Command11,在文本框Text2中输出逆序数,并在 Label3中输出判断结果(偶排列或者奇排列)。程序运行界面如图所示。
Function NiXuShu(s As String) As Integer '逆序数计算
Dim i As Integer, j As Integer, c As Integer , n(1 To 100) As Integer
c=0
For i= 1 To Len(s)
n(i) =Val(Mid(s, i, 1))
For j=1 To i- 1
ifThen
c=c+ 1
End If
Next j
Next i
End Function
Private Sub Command1_ Click()
Dim x As String, y As Integer
x = Text1.Text
Text2.Text = Str(y)
If y Mod 2= 0 Then Label3.Caption = "偶排列" Else Label3.Caption = "奇排列"
End Sub
试题篮