請問各位大大
誰能教我VB6以下題目
題目一 :
設計排序的程式。
提示:(1)輸入三數值。 (2)由大到小排列輸出
題目二 :
設計一個程式,找出曾經輸入的數值中之最大值及最小值。
提示:
(1)最大值初值=100。
(2)最小值初值=50。
(3)輸入值可以無限輸入。
2007-03-18 11:44:09 · 1 個解答 · 發問者 ㄚ燦 1 in 電腦與網際網路 ➔ 程式設計
題目一:
Dim A(3) As Integer
Dim I As Integer
Dim J As Integer
Dim T As Integer
For I = 1 To 3
A(I) = Val(InputBox("輸入三個數字,我將為你排大小 ( 數字" & I & " )", "輸入"))
Next I
For I = 1 To 2
For J = I + 1 To 3
If A(I) < A(J) Then
T = A(I)
A(I) = A(J)
A(J) = T
End If
Next J
Next I
For I = 1 To 3
Print A(I)
Next I
題目二 :
Dim K() As Long
Dim M As Integer
Dim N As Integer
M = 0
Do
M = M + 1
N = Val(InputBox("請輸入數字 (50~100),輸入999時停止輸入"))
ReDim Preserve K(M) As Long
If N <> 999 Then K(M) = N
Loop Until N = 999
M = M - 1
For I = 1 To M - 1
For J = I + 1 To M
If K(I) < K(J) Then
T = K(I)
K(I) = K(J)
K(J) = T
End If
Next J
Next I
Print "最大值為 : " & K(1) & vbCrLf & "最小值為 : " & K(M)
第二題的提示我不太清楚它的意思
所以 ... 有問題可以再提問
2007-03-19 17:08:09 · answer #1 · answered by ×`罐_v 3 · 0⤊ 0⤋