为毛loop 语句缺少do?Dim d(1 To 15) As DoubleDim i As DoubleDim flag As DoubleDim key As DoubleDim m As Doubled(1) = 0d(2) = 2d(3) = 3d(4) = 6d(5) = 7d(6) = 9d(7) = 11d(8) = 12d(9) = 13d(10) = 15d(11) = 18d(12) = 19d(13) = 20d(14) = 24d(15) = 25

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/29 15:42:52
为毛loop语句缺少do?Dimd(1To15)AsDoubleDimiAsDoubleDimflagAsDoubleDimkeyAsDoubleDimmAsDoubled(1)=0d(2)=2d(3

为毛loop 语句缺少do?Dim d(1 To 15) As DoubleDim i As DoubleDim flag As DoubleDim key As DoubleDim m As Doubled(1) = 0d(2) = 2d(3) = 3d(4) = 6d(5) = 7d(6) = 9d(7) = 11d(8) = 12d(9) = 13d(10) = 15d(11) = 18d(12) = 19d(13) = 20d(14) = 24d(15) = 25
为毛loop 语句缺少do?

Dim d(1 To 15) As Double
Dim i As Double
Dim flag As Double
Dim key As Double
Dim m As Double
d(1) = 0
d(2) = 2
d(3) = 3
d(4) = 6
d(5) = 7
d(6) = 9
d(7) = 11
d(8) = 12
d(9) = 13
d(10) = 15
d(11) = 18
d(12) = 19
d(13) = 20
d(14) = 24
d(15) = 25
key = InputBox("请输入一个数呦~")
i = 1
j = 15
flag = 0
Do While i <= j And flag = 0
m = Int(i + j) / 2
 If d(m) = key Then
 flag = m
Else
  If d(m) < key Then
  i = m + 1
  Else
  j = m - 1
  End If
  i = i + 1
  Loop
If flag = 0 Then
  Print "没有找到呦~"
  Else
  Print flag
End If
为什么就是不对啊~要哭了~

为毛loop 语句缺少do?Dim d(1 To 15) As DoubleDim i As DoubleDim flag As DoubleDim key As DoubleDim m As Doubled(1) = 0d(2) = 2d(3) = 3d(4) = 6d(5) = 7d(6) = 9d(7) = 11d(8) = 12d(9) = 13d(10) = 15d(11) = 18d(12) = 19d(13) = 20d(14) = 24d(15) = 25

do loop中有两个if,但就一个end if.

你应该这么写:

If condition Then
    [statements]
[ElseIf condition-n Then
    [elseifstatements] ...
[Else
    [elsestatements]]
End If

或者,if condition  then [statements]  写到一行内,就不需要end if了 

为毛loop 语句缺少do?Dim d(1 To 15) As DoubleDim i As DoubleDim flag As DoubleDim key As DoubleDim m As Doubled(1) = 0d(2) = 2d(3) = 3d(4) = 6d(5) = 7d(6) = 9d(7) = 11d(8) = 12d(9) = 13d(10) = 15d(11) = 18d(12) = 19d(13) = 20d(14) = 24d(15) = 25 Do Loop语句中的Loop While条件为真 如何理解,什么叫做条件为真? 用do loop语句描述判断一个数是否为素数的算法的步骤 do loop while语句 中条件为真是退出还是循环? Do While...Loop 和Do until...Loop 和 DO loop until 有关这类的语句给我解释下- Do While...Loop 和Do until...Loop 和 DO loop until 有关这类的语句给我解释下- Dim n% n = 1 Do Until n > 6 Print n; n = n + 2.4 Loop运行结果为1,3,5为什么不是1,3,6 VB中for next语句与DO WHILE..LOOP语句有什么不同?在VB中,for .next语句与DO WHILE..LOOP语句有什么不同? VB中的do while……loop 和do……loop while语句是一样的吗 vb中,do……loop while 语句中,比如下面 do print # i=i+1 loop while i while…end while语句与do…loop语句的具体区别? 问一道VB填空题:Private Sub Form_Click() Dim x As Integ问一道VB填空题:Private Sub Form_Click()Dim x As Integerx=5Do Print x;x=x-1Loop While Not xEnd Sub(A)5 (B)5 4 3 2 1(C)出现语法错误的信息 (D)陷入 谁能帮我决绝这条QB编程题?求出乘积为399的两个相邻的奇数用do until...loop语句写 用Do...Loop循环语句,求m和n的最大公约数,以下是程序代码,Private Sub Command1_Click()Dim m As Long,n As Long,t As Longm = Val(Text1.Text)n = Val(Text2.Text)If m < n Thent = m:m = n:n = tEnd IfDor = m Mod nm = nn = rLoop While r 0Labe VB 函数 do while ...Loop 与 while .wend 的区别Dim D As VariantDim E() As IntegerDo While A1 0A1 = 0For i2 = 0 To UBound(D)If D(i2) > A1 ThenA1 = D(i2) End If 'D(i2) > A1Next 'i2 = 0ReDim Preserve E(i3) As Integer E(i3) = A1i3 = i3 + 1For i2 = 0 do while Until loop语句格式,执行过程是什么?我是初学者, 程序设计,此题的程序是什么,用loop until或do这种语句写 利用Do…Loop循环语句求从1到100的累加和 用Do Loop语句求平方小于1000的最大整数