大橙子网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

包含vb.net实验题作业的词条

用VB.NET编一个模拟袖珍计算器的完整程序

Public Class Form1

目前成都创新互联公司已为1000+的企业提供了网站建设、域名、网页空间、网站托管、服务器托管、企业网站设计、罗湖网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim c As Char

c = Trim(TextBox3.Text)

Select Case c

Case "+"

TextBox4.Text = Val(TextBox1.Text) + Val(TextBox2.Text)

Case "-"

TextBox4.Text = Val(TextBox1.Text) - Val(TextBox2.Text)

Case "*"

TextBox4.Text = Val(TextBox1.Text) * Val(TextBox2.Text)

Case "\"

If Val(TextBox2.Text) = 0 Then

MsgBox("分母为0")

Else

TextBox4.Text = Val(TextBox1.Text) \ Val(TextBox2.Text)

End If

Case "/"

If Val(TextBox2.Text) = 0 Then

MsgBox("分母为0")

Else

TextBox4.Text = Val(TextBox1.Text) / Val(TextBox2.Text)

End If

End Select

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

End

End Sub

End Class

刚敲完代码,望采纳

VB.NET 考试题目 急 求高手啊

(1)ByVal num as Integer() ,ByVal strInput as string

(2) strInput.Length -1

(3)strScript(i)

(4) Num(j)+1

Function mysqr(ByVal num) as string

Dim retVal as string

if num0 then

num =-num

retVal =Math.Sqrt(num).tostring +"i"

else

retVal =Math.Sqrt(num).tostring

end if

return retVal

End function

VB.NET程序题

1、

For j = 3 To 19 Step 4

m += 1

Next

为循环5次

For i = 1 To 15 Step 4

Next

为循环4次

则总共循环4*5=20,m没循环一次+1,则m=20

2、从下面这段可以看出“*”与“#”是同步的(因为走else时,会继续循环),有“*”肯定“#”,而输出“*”只有当i=2,4时,则有2次,为*#*#

For i = 1 To 5

If i Mod 2 = 0 Then

Console.Write("*")

Else

ContinueFor

EndIf

Console.Write("#")

Next

在加上最後次输出:Console.WriteLine("$")

结果则为:*#*#$

vb.net的两道题

1.编程求1!+3!+5!+....+n! N由inputbox获取

Function Math(ByVal N As Integer) As Integer

Dim c As Integer = 1

For i = 1 To N

c *= i

Next

Return c

End Function

Dim N As String = InputBox("输入N的值.")

If N = "" Then Return

MessageBox.Show(Math(N))

2.用最简单的方法将个位数和十位数互换,一定要最简单的方法..比如31换成13.

Dim s As String = InputBox("输入一个十位数.")

If s = "" Then Return

MessageBox.Show(StrReverse(s))

VB.NET 编程 关于回文数的题目。

在WinForm项目的窗体上添加一个按钮和文本框,然后把下面的代码粘贴上去就可以了。

Public Function lsH(ByVal n As String) As String

Dim s1 As String = ""

Dim s2 As String = ""

Dim i As Integer = 0

Dim j As Integer

If n.Length = 1 Then

Return ("是回文数")

Else

If Tell_JiOu(n.Length) = 1 Then

j = (n.Length + 1) / 2

s1 = Mid(n, 1, j)

Else

j = n.Length / 2 + 1

s1 = Mid(n, 1, j - 1)

End If

For i = n.Length To j Step -1

s2 = s2 + Mid(n, i, 1)

Next

If s1 = s2 Then

Return "是回文数"

Else

Return "不是回文数"

End If

End If

End Function

'判断一个整数的奇偶

Public Function Tell_JiOu(ByVal k As Integer) As Integer

If k Mod 2 = 0 Then

Return 2

Else

Return 1

End If

End Function

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click

Button.Text = lsH(TextBox1.Text)

End Sub


分享名称:包含vb.net实验题作业的词条
标题网址:http://dzwzjz.com/article/hpghso.html
在线咨询
服务热线
服务热线:028-86922220
TOP