
图 a 图 b
(1)当 n=6,原始数据为“8 39 24 5 71 25”,此时极大值有: 。
(2)请在划线处填入合适的代码。 Const n = 10
Dim a(1 To n) As Integer '存储原始数据 Dim Max(1 To n) As Integer '存储极大值数据
Private Sub Form_Load() '原始数据初始化
Randomize
For i = 1 To n
a(i) = ① '产生[1,99]间随机整数
List1.AddItem Str(a(i))
Next i End Sub
Private Sub Command1_Click()
Dim i As Integer, j As Integer
Dim count As Integer, Maxa As Integer
count = 0
List2.Clear
For i = 2 To n - 1 '统计极大值,左右两边端点值除外
If ② Then
count = count + 1
③ = a(i)
End If
Next i
Maxa = 0
For i = 1 To count
List2.AddItem Str(Max(i))
If Maxa < Max(i) Then
Maxa = Max(i)
End If
Next i
Label1.Caption = "极大值中的最大值为:" + Str(Maxa) End Sub

同类型试题

y = sin x, x∈R, y∈[–1,1],周期为2π,函数图像以 x = (π/2) + kπ 为对称轴
y = arcsin x, x∈[–1,1], y∈[–π/2,π/2]
sin x = 0 ←→ arcsin x = 0
sin x = 1/2 ←→ arcsin x = π/6
sin x = √2/2 ←→ arcsin x = π/4
sin x = 1 ←→ arcsin x = π/2


y = sin x, x∈R, y∈[–1,1],周期为2π,函数图像以 x = (π/2) + kπ 为对称轴
y = arcsin x, x∈[–1,1], y∈[–π/2,π/2]
sin x = 0 ←→ arcsin x = 0
sin x = 1/2 ←→ arcsin x = π/6
sin x = √2/2 ←→ arcsin x = π/4
sin x = 1 ←→ arcsin x = π/2

