Public Class Form1
目前成都創(chuàng)新互聯(lián)公司已為1000+的企業(yè)提供了網(wǎng)站建設(shè)、域名、網(wǎng)頁空間、網(wǎng)站托管、服務(wù)器托管、企業(yè)網(wǎng)站設(shè)計、羅湖網(wǎng)站維護等服務(wù),公司將堅持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長,共同發(fā)展。
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
剛敲完代碼,望采納
(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
1、
For j = 3 To 19 Step 4
m += 1
Next
為循環(huán)5次
For i = 1 To 15 Step 4
Next
為循環(huán)4次
則總共循環(huán)4*5=20,m沒循環(huán)一次+1,則m=20
2、從下面這段可以看出“*”與“#”是同步的(因為走else時,會繼續(xù)循環(huán)),有“*”肯定“#”,而輸出“*”只有當(dāng)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("$")
結(jié)果則為:*#*#$
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.用最簡單的方法將個位數(shù)和十位數(shù)互換,一定要最簡單的方法..比如31換成13.
Dim s As String = InputBox("輸入一個十位數(shù).")
If s = "" Then Return
MessageBox.Show(StrReverse(s))
在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 ("是回文數(shù)")
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 "是回文數(shù)"
Else
Return "不是回文數(shù)"
End If
End If
End Function
'判斷一個整數(shù)的奇偶
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
當(dāng)前標(biāo)題:包含vb.net實驗題作業(yè)的詞條
標(biāo)題網(wǎng)址:http://vcdvsql.cn/article30/hpghso.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站導(dǎo)航、網(wǎng)站改版、全網(wǎng)營銷推廣、網(wǎng)站設(shè)計公司、微信公眾號、虛擬主機
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)