1)产生一个1到100之间的随机整数,然后判断这个数是奇数还是偶数?2)判断这个数是正数、负数?3)一个密码验正程序,如果输入密码正确(设计默认密码为abcd),显示“密码正确”,如果输入密码错误,显示“密码错误,请重新输入!”,当输入3次错误密码时,显示“三次错误,退出系统!”,结束程序

解决方案 »

  1.   

    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
      
    *****************************************************************************
    欢迎使用CSDN论坛阅读器 : CSDN Reader(附全部源代码) 
    http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html
      

  2.   

    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
      

  3.   

    第一个忘了判断奇偶数,改:
        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
      

  4.   

    2.倒死 x>0正 x<0负
      

  5.   

    2.    abs(-3)=abs(3)
      

  6.   

    static int times
    if strpwd="abcd" then
     msgbox "“密码错误,请重新输入"
    else
     msgbox "“密码正确"
    endiftimes=times+1
    if times >=3 then
    end
    endif
      

  7.   

    static int times
    if strpwd="abcd" then
     msgbox "“密码错误,请重新输入"
    else
     msgbox "“密码正确"
    endiftimes=times+1
    if times >=3 then
    end
    endif