1。 3 mod 2 2. abs(-3)=abs(3) 3. static int times if strpwd="abcd" then msgbox "“密码错误,请重新输入" else msgbox "“密码正确" endiftimes=times+1 if times >=3 then end endif
1)产生一个1到100之间的随机整数,然后判断这个数是奇数还是偶数? Dim n As Integer Randomize Timer n = Int(Rnd * 100 + 1) Debug.Print n 2)判断这个数是正数、负数? if n>0 then msgbox n & "是正数!" elseif n<0 then msgbox n & "是负数!" end if
第一个忘了判断奇偶数,改: Dim n As Integer Randomize Timer n = Int(Rnd * 100 + 1) Debug.Print n If n\2=n/2 Then msgbox n & "是偶数!" else msgbox n & "是奇数!" end if
2.倒死 x>0正 x<0负
2. abs(-3)=abs(3)
static int times if strpwd="abcd" then msgbox "“密码错误,请重新输入" else msgbox "“密码正确" endiftimes=times+1 if times >=3 then end endif
static int times if strpwd="abcd" then msgbox "“密码错误,请重新输入" else msgbox "“密码正确" endiftimes=times+1 if times >=3 then end endif
2. abs(-3)=abs(3)
3.
static int times
if strpwd="abcd" then
msgbox "“密码错误,请重新输入"
else
msgbox "“密码正确"
endiftimes=times+1
if times >=3 then
end
endif
*****************************************************************************
欢迎使用CSDN论坛阅读器 : CSDN Reader(附全部源代码)
http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html
Dim n As Integer
Randomize Timer
n = Int(Rnd * 100 + 1)
Debug.Print n
2)判断这个数是正数、负数?
if n>0 then
msgbox n & "是正数!"
elseif n<0 then
msgbox n & "是负数!"
end if
Dim n As Integer
Randomize Timer
n = Int(Rnd * 100 + 1)
Debug.Print n
If n\2=n/2 Then
msgbox n & "是偶数!"
else
msgbox n & "是奇数!"
end if
if strpwd="abcd" then
msgbox "“密码错误,请重新输入"
else
msgbox "“密码正确"
endiftimes=times+1
if times >=3 then
end
endif
if strpwd="abcd" then
msgbox "“密码错误,请重新输入"
else
msgbox "“密码正确"
endiftimes=times+1
if times >=3 then
end
endif