1樓:匿名使用者
先不管你的txt3是怎麼來的,單就程式而言,txt1比txt2小,所以你的if條件判斷後始終會把txt1的值2傳遞給txt3,於是txt3值一直都是2.
2樓:匿名使用者
txt1 = 2
txt2 = 5
這說明你這兩個數是固定的2、5
所以永遠是txt1 < txt2
所以永遠是txt3 = txt1=2
3樓:喻元愷
你的txt3在哪兒定義的
vb比較兩個數大小
4樓:匿名使用者
您好:這個很簡單,這道題目考的是您使用 if 條件函式的用法,請參見下面**。
正確用法示例:
if a > b then
'a大於b
else
『b大於a
end if
按照您的要求,您可以更改為如下**,即可實現您的要求:
if text1.text > text2.text thentext3.text = '大數是:' + text1.textelse
text3.text = '大數是:' + text2.textend if
若有疑問,您可以繼續追問。
希望對您有用!
5樓:天天過節
private sub command1_click()
text3 = "最大數是:" + iif(text1 > text2, text1, text2)
end sub
6樓:
if int(text1.text)>int(text2.text) then
text3.text ="大數是:" & text1.textelse
text3.text ="大數是:" & text2.textend if
vb程式設計 輸入兩個數比較大小 顯示較大數
7樓:吾桐語
private sub command1_click()a = text1.text
b = text2.text
if a > b then
print a
else
print b
end if
end sub
8樓:
pivate sub command1_click()dim t
a = val(text1.text)
b = val(text2.text)
if a> b then
t = a
a= b
b = t
end if
max=a
label2.caption = max
end sub
用vb程式設計來比較三個數的大小
9樓:深閨老漢
是自學的嗎
如果 a>b 那麼
max=a
否則max=b
此時max是a和b中的最大值
接下來只需讓max和c進行比較就可以得出最大值具體**不給你了,思路有了自己去編比較好
10樓:匿名使用者
呵呵 兄弟 少了end if 。
完整的**:
private sub command1_click()dim a,b,c as integer
a = val(text1.text)
b = val(text2.text)
c = val(text3.text)
dim max as integer=a
if max < b then
max = b
elseif max < c then
max = c
end if
label2.caption = max
end sub
11樓:
應該把max < b 和max
12樓:神宗罪
private sub command1_click()dim a as single
dim b as single
dim c as single
dim max as single
a=val(text1.text)
b=val(text2.text)
c=val(text3.text)
if amax=b
b=aa=b
end if
if a
max=c
c=aa=c
end if
if b
max=c
c=bb=c
end if
lable1.caption="a"
end sud
13樓:匿名使用者
private sub command1_click()dim t
a = val(text1.text)
b = val(text2.text)
c = val(text3.text)
if a> b then
t = a
a= b
b = t
end if
if a > c then
t = a
a= c
c= t
end if
if b > c then
t = b
b = c
c= t
end if
max=a
label2.caption = max
end sub
14樓:匿名使用者
可以的,沒問題呀。
你把錯誤的數也放上來吧
(vb)判斷兩個數值大小,並給出小的
15樓:dl_會飛的青蛙
提問題的時候你可沒有這麼多要求!~
你直接用我的**吧
你的**問題太多
private sub command1_click()dim a as double, b as doublea = text1.text: b = text2.
textif isnumeric(a) and isnumeric(b) then
else
msgbox ("你幹哈啊,讓你輸入數值,知道啥叫數值不,重來!")text1.text = ""
text2.text = ""
text3.text = ""
end if
if a = b then
msgbox ("警告:你有毛病啊,比大小,你整倆一樣的,重來!")text1.text = ""
text2.text = ""
text3.text = ""
else
if a > b then
text3.text = b
else
text3.text = a
end if
end if
end sub
16樓:匿名使用者
private sub command1_click()dim a, b
a = val(text1.text)
b = val(text2.text)
if isnumeric(a) and isnumeric(b) then
if a = b then
msgbox ("警告:你有毛病啊,比大小,你整倆一樣的,重來!")text1.text = ""
text2.text = ""
text3.text = ""
elseif a > b then
text3.text = b
elseif a < b then
text3.text = a
end if
else
msgbox ("你幹哈啊,讓你輸入數值,知道啥叫數值不,重來!")text1.text = ""
text2.text = ""
text3.text = ""
end if
end sub
分子相同的兩個數怎樣比較大小,分子相同分母不同怎麼比大小?
分子相同的 兩個數比較大小 分母越大,分數越小,分母越小,分數越大。內分母相同的兩個數比較容大小 相同的的情況下,分子越大的分數就越大。分子分母都不相同的,首先通分,然後再比較大小。對於兩個真分數,如果分子和分母相差相同的數,則分子和分母都大的分數比較大。對於兩個假分數,如果分子和分母相差相同的數,...
把下面每組數中的兩個數通分在比較大小6分之5和8分之
seraphim丶小沫,你du好 6分之zhi5和8分之7 5 6 20 24,7 8 21 24 因為20 24 21 24,所dao以版 權5 6 7 8 3 7 27 63,2 9 14 63 因為27 63 14 63,所以3 7 2 9 4 9 8 18 因為8 18 7 18,所以4 9...
分母相同的兩個分數怎樣比較大小分子相同的兩個分數
分母相同的兩個分數分子大的分數比較大。分子相同的兩個分數父母小的分數比較大。分母相同的兩個分數怎樣比較大小?分子相同的兩個分數呢?分數比較大小 分子相同時,分母越小,分數越大 也可以用通分 分母相同時,分子越大,分數越大。分數的大小比較 分母相同的分數,分子大的分數大 分子相同的分數,分母小的分數大...