作业帮 > 综合 > 作业

vb 定义m=array(a,b,c,d,e,f)为一数组 if n=“数组中的任意一个不等于0的数”该怎么表达呢?谢

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/08/24 18:59:11
vb 定义m=array(a,b,c,d,e,f)为一数组 if n=“数组中的任意一个不等于0的数”该怎么表达呢?谢
m = Array(a,b,c,d,e,f)
For i = 0 To UBound(m)
If n = m(i) And n 0 Then
'你的语句
Exit For
End If
Next
再问: 谢谢,见笑了,初学者 再问问 把 式中“你的语句”变为 x= “数组中另一不等于0且不等于m(i)的数”
再答: 不明白,还是if语句?
再问: 完整的如下:vb 定义m=array(a,b,c,d,e,f)为一数组 if n=“数组中的任意一个不等于0的数”then x= “数组中另一不等于0且不等于m(i)的数”谢谢 我试着这么表达看可对哈 m = Array(a, b, c, d, e, f) For i = 0 To UBound(m) If n = m(i) And n 0 Then for j=0 to UBound(m) x= m(j) and x0 Exit For Next Exit For End If Next if x=null then msgbox "没有符合条件的数" end if
再答: dim f as boolean \m = Array(a, b, c, d, e, f) f=false For i = 0 To UBound(m) If n = m(i) And n 0 Then for j=0 to UBound(m) if ij and m(j)0 then x=m(j) f=true Exit For end if Next j if f then Exit For End If Next i if not f then msgbox "没有符合条件的数" end if