編寫程式當單擊窗體時用輸入框(inputbox函式)輸入自然數,判斷是否“正數”“負數”或“0”,並

時間 2021-08-11 17:37:27

1樓:匿名使用者

private sub command1_click()a = inputbox("輸入號碼")

if a > 0 then

msgbox "正數"

elseif a < 0 then

msgbox "負數"

elseif a = 0 then

msgbox "0"

end if

end sub

就這麼簡單 純手打

2樓:匿名使用者

a = inputbox("輸入號碼")

if a > 0 then

msgbox "整數"

elseif a < 0 then

msgbox "負數"

elseif a = 0 then

msgbox "0"

end if

3樓:閩南青柚

用符號判斷 啊

>0 <0 =0

例如判斷text1

if text1.text > 0 thenmsgbox "正數"

end if

if tex1.text < 0 thenmsgbox "負數"

end if

if text1.text = 0 thenmsgbox "這個還用說?"

end if

這是 個例子,相信您已經能夠明白了吧

單擊窗體form1時,用inputbox函式輸入一個整數n,

4樓:天雨下凡

private sub userform_click()dim n as integer

n = val(inputbox("輸入一個整數:"))if n mod 2 = 1 then

msgbox "奇數", vbinformationelse

msgbox "偶數", vbinformationend if

end sub

5樓:呆萌小咖

dim a as integer

a = inputbox("輸入一個數")if a mod 2 = 0 then

msgbox ("偶數")

else

msgbox ("奇數")

end if

VB編寫程式 設計程式,當單擊窗體時,在窗體上顯示任意一

假設你的 路徑為d fafa.gif,如下 private sub form click picture1.picture iif picture1.picture loadpicture loadpicture d fafa.gif loadpicture end sub 這樣就可以單擊切換 了,...

編寫程式輸入兩個正整數m和,編寫程式,輸入兩個正整數m 和n 1 m,n 1000 ,輸出m n 之間的所有滿足各位數字的立

碧血玉葉花 include int is int number if s b return 1 else return 0 int main void include include int is int number int main void int m,n,y,result printf m,...

使用者用vb編寫程式 輸入年份和月份,程式能夠判斷其是否是閏年,那個季節,這個月多少天

將以下內容復到記事本中 然後 儲存為 form1.frm version 5.00 begin vb.form form1 caption form1 clientheight 4830 clientleft 60 clienttop 450 clientwidth 8325 linktopic f...