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
用delphi7編寫程式。任一輸入整數,判斷整數的
1 使用mod判斷餘數,如果為1則為奇數,否則為偶數2 示例如下回 procedure tform1.btn1click sender tobject varnb integer begin nb strtoint edt1.text if nb mod 2 1 thenbegin showmess...
用指標編寫程式,用指標編寫一個程式
include include include define max 100 輸入的最大字元數為100 int main printf character total number is d n total printf upper character number is d n count upp...
編寫程式,從鍵盤輸入實數x,用下式計算並輸出y的值 精確到小數點後2位
include include int main 編寫程式,從鍵盤輸入x的值,計算並輸出分段函式y的值y 1 x 0 include int main include int sign int x int main int sign int x include using namespace std...