VB 程序段Dim c As Integer,a(0 To 5) As Integer For i = 1 To 5a(i) = i Next ic = 0For i = 1 To 5x = Int(Rnd * 5 + 1)If a(x Mod 5) = i + 2 Then c = c + 1 If c = x Then Exit Fori = i - 1Next i运行该程序后,变量 c 的值不可能是()A.1B.2C.3...
2设有如下程序: Private Sub Command1_Click() Dim C As Integer, d As Integer c=4 d=InputBox("请输入一个整数") Do While d>0 If d>c Then c=c+1 End If d=InputBox("请输入一个整数") Loop Print c+d End Sub 程序运行后,单击命令按钮,如果在输入对话框中依次输入1、2、3、4、5、6...
阅读下列程序,写出运行结果。Dim a as IntegerDim b as IntegerDim c as Integera=1b=1Fori=1 To 4c=a+ba=bb=cNext iPrint c运行结果是 相关知识点: 试题来源: 解析 【答案】8【解析】【详解】本题考查的是VB循环语句。Fori=1To4表示循环从i=1、2、3、4开始,共执行四次。初始值:a=1,b=1。
Dim b As Integer Dim c As Integer a=Val(Text1.Text) b=Val(Text2.Text) c=a Do While c Mod b<>0 c=c+a Loop Text3.Text=Str(c)End Sub在文本框Text1和Text2中分别输入6和9,单击按钮Command1,文本框Text3中显示的内容是___,该程序段的功能是___. ...
在窗体上画一个名称为Command1的命令按钮,然后编写如下程序: Option Base 1 Private Sub Command1_Click() Dim c As Integer, d As Integer d=0 c=6 x=Array(2, 4, 6, 8, 10, 12) For i=1 To 6 If x(i)>c Then d=d+x(i) c=x(i) Else d=d-c End If Next i Print d End Sub ...
设有数组说明语句:Dim c(10) AS Integer,则下面表示数组c的元素选项中()是错误的。A.c(i-1)B.c(5+0.5)C.c(0)D.c(11)
A. 13 B. 2 C. 3 D. 4 相关知识点: 试题来源: 解析 D 【详解】 本题主要考查VB程序的执行与调试。s = “where are you”,count=0,第一个for循环实现将字符串s中的每一个字符赋给数组a,第二个for循环,当i=1时,执行完内层循环后,a(1)~a(13)分别为“yhere are wou”;当i=2时,执行完内层...
程序执行完,数组c(0)~c(10)中,c(1)=1,c(2)=3,c(3)=1,c(5)=1,其余值为0,第二个for循环,当c(i)大于0时,输出c(i)的值,故执行该程序段,标签 Label1上显示的内容是1311,故本题选C选项。结果一 题目 有以下VB程序段Dim c(-10 To 10) As Integer, a(1 To 10)As Integer, b(1 ...
Dim c As Integer Dim j As Integer A(1) = "4" A(2) = "8" A(3) = "12" c = 1 For j = 1 To 3 c = c + Val(A(j)) Next j Print c End Sub 写出程序运行时单击窗体后,窗体 Form1 上的结果。相关知识点: 试题来源: 解析 3000 反馈...
Dim c As IntegerPrivate Sub Form_ Load( )c=0:Text1.Text=" "End SubPrivate Sub Text1_ Change( )If Val(Text1. Text) > 0 ThenText1. Text = Str(Val(Text1. Text) \ 2)c=c+1End IfText2. Text = Str(c)End Sub运行该程序,在文本框Text1中输入5,则Text1和Text2中显示的内容分别是...