用vb.net进行逻辑“与”运算的代码如下,请大神帮忙看看哪里不对Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim i, p As Integer, c, d As String
c = Trim(TextBox1.Text)
d = Trim(TextBox2.Text)
ReDim A(c.Length - 1)
ReDim B(d.Length - 1)
For i = 0 To c.Length - 1
A(i) = c.Substring(i, 1)
Next
For i = 0 To d.Length - 1
B(i) = d.Substring(i, 1)
Next
m = A.Length
n = B.Length
If m = n And m0 Then
ReDim F(m - 1)
Label3.Text = "F="
For i = 0 To m - 1 Step 1
If A(i) = "1" And B(i) = "1" Then
F(i) = 1
Else
F(i) = 0
End If
Label3.Text = F(i)
Next i
Else
If m = 0 Or n = 0 Then
MessageBox.Show("输入不能为空vb.net逻辑运算器!", "错误提示")
Exit Sub
Else
MessageBox.Show("字符串长度不一致", "错误提示")
Exit Sub
End If
End If
End Sub
VB.Net中的Or是什么意思?在逻辑运算中表示 或者
称作逻辑或
用法 if 1 or 0 then print 111
vb:简易计算器(加减乘除)代码代码如下:
Dim t, t1 As Integer
Dim x, y As Double
Public Sub com()
x = Val(l1.Caption)
Select Case t1
Case Is = 1: y = y + x
Case Is = 2: y = y - x
Case Is = 3: y = y * x
Case Is = 4: y = y / x
End Select
t1 = 0
t = 0
l1.Caption = "0"
End Sub
Private Sub Form_Load()
x = 0
y = 0
t = 0
t1 = 1
End Sub
Private Sub c0_Click(Index As Integer)
If l1.Caption = "0" Then
l1.Caption = "0"
Else
l1.Caption = l1.Caption + "0"
End If
End Sub
Private Sub C1_Click(Index As Integer)
If l1.Caption = "0" Then
l1.Caption = "1"
Else
l1.Caption = l1.Caption + "1"
End If
End Sub
Private Sub c10_Click(Index As Integer)
If t = 0 Then
l1.Caption = l1.Caption + "."
t = 1
End If
End Sub
Private Sub C2_Click(Index As Integer)
If l1.Caption = "0" Then
l1.Caption = "2"
Else
l1.Caption = l1.Caption + "2"
End If
End Sub
Private Sub C3_Click(Index As Integer)
If l1.Caption = "0" Then
l1.Caption = "3"
Else
l1.Caption = l1.Caption + "3"
End If
End Sub
Private Sub C4_Click(Index As Integer)
If l1.Caption = "0" Then
l1.Caption = "4"
Else
l1.Caption = l1.Caption + "4"
End If
End Sub
Private Sub C5_Click(Index As Integer)
If l1.Caption = "0" Then
l1.Caption = "5"
Else
l1.Caption = l1.Caption + "5"
End If
End Sub
Private Sub C6_Click(Index As Integer)
If l1.Caption = "0" Then
l1.Caption = "6"
Else
l1.Caption = l1.Caption + "6"
End If
End Sub
Private Sub C7_Click(Index As Integer)
If l1.Caption = "0" Then
l1.Caption = "7"
Else
l1.Caption = l1.Caption + "7"
End If
End Sub
Private Sub C8_Click(Index As Integer)
If l1.Caption = "0" Then
l1.Caption = "8"
Else
l1.Caption = l1.Caption + "8"
End If
End Sub
Private Sub C9_Click(Index As Integer)
If l1.Caption = "0" Then
l1.Caption = "9"
Else
l1.Caption = l1.Caption + "9"
End If
End Sub
Private Sub z1_Click(Index As Integer)
com
t1 = 1
End Sub
Private Sub z2_Click(Index As Integer)
com
t1 = 2
End Sub
Private Sub z3_Click(Index As Integer)
com
t1 = 3
End Sub
Private Sub z4_Click(Index As Integer)
com
t1 = 4
End Sub
Private Sub z5_Click(Index As Integer)
tmp = Mid(l1.Caption, Len(l1.Caption), 1)
If tmp = "." Then
t = 0
推荐阅读
- 东莞网站制作价格,东莞网站制作机构
- 路由器连接受限制怎么办,无线路由器连接受限是怎么回事
- 动作忍者游戏横版,忍者 动作游戏
- 修改硬盘后怎么找回数据,硬盘信息修改
- python生成函数图像 python 函数绘图
- 如何找到橙子电商平台,如何找到橙子电商平台客服
- centos7下安装oracle详细过程,centos75安装oracle11g
- 电脑坏了显卡怎么修复,电脑显卡坏了电脑会怎么样
- linux命令被禁止 linux解除禁ping