1樓:匿名使用者
private sub ***mand1_click()
dim a as integer, b as integer, c as integer
dim max as integer, min as integer
a = val(inputbox("輸入du
第1個整
zhi數dao", "input"))
b = val(inputbox("輸入第2個整數", "input"))
c = val(inputbox("輸入第3個整數", "input"))
max = a
if b > max then max = b
if c > max then max = c
min = a
if b < min then min = b
if c < min then min = c
print max, a + b + c - max - min, min
end sub
2樓:匿名使用者
option base 1
dim a(3) as string
dim i as integer
dim j as integer
dim x as string
private sub ***mand1_click()for i = 1 to 3
a(i) = inputbox("請輸
copy入第" & i & "個值")
next i
for i = 1 to 2
for j = i + 1 to 3
if a(i) > a(j) then
b = a(i)
a(i) = a(j)
a(j) = b
end if
next j
next i
for i = 1 to 3
print tab((i * 5) - 1); a(i);
next i
end sub
3樓:匿名使用者
dim i, j as integer
dim a(1 to 3) as integerdim maxa as integer
for i = 1 to 3
a(i) = val(inputbox("請輸bai入du
第zhi
dao" & i & "個數
內容"))
next i
for i = 1 to 3
maxa = a(i)
for j = i to 3
if maxa < a(j) then
maxa = a(j)
a(j) = a(i)
a(i) = maxa
end if
next j
next i
for i = 1 to 3
print a(i)
next i
4樓:御綸英靜嫻
使用一個輸入框的話就需要確定3個數字的分隔符,然後用split函式把inputbox的字串拆開。
如果使內用容三個字串可以這樣寫:
dima,
b,c,d,e
assinglea=
val(inputbox("請輸入第一個數字"))b=val(inputbox("請輸入第二個數字"))c=val(inputbox("請輸入第三個數字"))d=a+b+
ce=d
/3msgbox
"和值:"&d
&""&
"平均值:"&e
編寫vb程式輸入數能否被235整除
option explicit private sub mand1 click dim inputstr as string dim inputvalue as double inputstr inputbox 請輸入一個數 等待輸入 if len inputstr 0 then exit sub ...
請教高手 輸入三個數,按從大到小排序輸出
有好多種做法喲。下面的方法為冒泡法排序,不過用的是陣列 其實還有選擇法排序 也可以不用陣列,可以用指標 因為是三個數嘛,所以也可以直接寫,不需要陣列的 include define n 3 void main int i,j float t a 3 for i 0 iscanf f a i for ...
編寫程式,從鍵盤輸入三位數,求出其逆序數並輸出,例如輸入
沒指明bai語言du 用zhic 寫,dao 版如下。權 include using namespace std void main cout c語言程式設計 輸出一個3位整數的逆序數,如輸入123,輸出321.我這個是c 的答案。看了一下,別人要麼沒用到c 專屬的cin cout 要麼是錯的.而且...