使用下列命令定义了数组x后,所有数组元素具有相同的 ( )Dim x(99) As IntegerFor i = 0 To UBound(x) x(i) = iNext i
A: 存储地址
B: 下标
C: 值
D: 类型
A: 存储地址
B: 下标
C: 值
D: 类型
举一反三
- 使用数组x输出10个1-100之间的随机整数(包括1和100),下列命令中正确的是:( ) A: Dim x(9) As Integer For i = 1 To UBound(x) x(i) = Int(Rnd() * 100 + 1) Print x(i); Next B: Dim x(9) As Integer For i = 0 To UBound(x) x(i) = Rnd(10) Print x(i); Next C: Dim x(9) As Integer For i = 0 To UBound(x) x(i) = Int(Rnd() * 100 ) Print x(i); Next D: Dim x(9) As Integer For i = 0 To UBound(x) x(i) = Int(Rnd() * 100 + 1) Print x(i); Next
- 若要引用某数组x的数组元素,该元素的下标为i,则i的取值范围为[Ubound(x),Lbound(x)]
- 下列程序代码将整型动态数组x定义为具有20个元素的数组(数组元素的下标从1到20),并给数组的所有元素赋值1。请完善程序。 Dim x( ) As IntegerPrivate Sub Cmd1_Click() ReDim For i = 1 To 20 x(i) = 1 Print x(i) Next iEnd Sub
- 如果定义以下数组和变量,则数组元素的有效引用是_____。 int x[5];int i=0 ; A: x[i*i] B: x[2+3] C: x[i] D: x[i+1] E: x[2*i]
- 把x数组各元素逆序存入数组y写作:for(i=0;i<;n;i++)________; A: y[i]=x[i] B: y[i]=x[n-i] C: y[n-i]=x[i] D: y[i]=x[n-i-1]