vb點(diǎn)虐 大題 vbnet implements

vb點(diǎn)虐 面試題,請大家?guī)兔Γx謝。

如果需要講詳細(xì)一點(diǎn),那就加我QQ531412815

創(chuàng)新互聯(lián)從2013年創(chuàng)立,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目網(wǎng)站設(shè)計(jì)、成都網(wǎng)站建設(shè)網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個夢想脫穎而出為使命,1280元臨縣做網(wǎng)站,已為上家服務(wù),為臨縣各地企業(yè)和個人服務(wù),聯(lián)系電話:028-86922220

第4題,潛在的錯誤,這里的錯誤不是常規(guī)錯誤,屬于那種只有在運(yùn)行是才知道的錯誤:

Catch ex As Exception

MsgBox(ex.StackTrace)

'永遠(yuǎn)不會查找下面的錯誤

Catch ex As ArgumentNullException

MsgBox("Input Test box cannot be null.")

Catch ex As OverflowException

MsgBox("Input Test box 2 cannot be zero!")

Catch ex As FormatException

MsgBox("Input Test box should be numeric format!")

結(jié)構(gòu)化錯誤處理永遠(yuǎn)達(dá)不到下面這里,因?yàn)镃atch ex As Exception 已經(jīng)處理了所有錯誤.

第5題:

00123

1000 60.50

2000 60.00

3500 59.50

---- -----

6500 60.00

00124

3000 60.50

---- -----

3000 60.50

00125

2000 59.50

1000 58.00

---- -----

3000 58.75

就是按照Ref_ID 分類,有一種方法就是按照Ref_ID 分組,也就是使用SQL語言,不過這里需要該很多,

我就不用了,那么就稍微復(fù)雜一點(diǎn),使用FIND方法,不過有一點(diǎn)必須注意REF_ID必須排序,因?yàn)閿?shù)據(jù)庫中

已經(jīng)排好序了,我就不用排了。

Dim rst as ADODB.Recordset

dim refID as string

Rst = GetRecordset

Do While Not rst.EOF

refid=rst(0)

Console.writeline(rst.Fields("Ref_ID")

do

Console.writeline rst.Fields("Qty") vbcrlf rst.Fields("Price"))

rst.MoveNext()

loop while rst(0)=refid

Loop

第6題:就是從一個集合中取元素輸出的問題

比較簡單的辦法就是使用遞歸

以下是使用VB的方法(可以移植到VB.NET上,因?yàn)槲覍B.NET的數(shù)組到現(xiàn)在還不太會,所以就將就一下)

Dim bUse() As Boolean

Dim lStr() As String * 1

Dim nCount As Byte

-----------------------------------------------------------------------------------

Public Sub Combination(lstStr As String)

Dim i As Byte

Dim j As Byte

Dim StrLen As Byte

StrLen = Len(lstStr)

ReDim bUse(1 To StrLen) As Boolean

ReDim lStr(1 To StrLen) As String * 1

For i = 1 To StrLen

lStr(i) = Mid(lstStr, i, 1)

Next

For i = 1 To StrLen

nCount = i

GoWith StrLen, 1, 0, ""

Next

End Sub

------------------------------------------------------------------------------------

Public Sub GoWith(ECount As Byte, nStart As Byte, Deep As Byte, lastStr As String)

Dim i As Byte

If Deep = nCount Then

Debug.Print lastStr

Exit Sub

End If

For i = nStart To ECount

If Not bUse(i) Then

bUse(i) = True

GoWith ECount, i, Deep + 1, lastStr lStr(i)

bUse(i) = False

End If

Next

End Sub

--------------------------------------------------------------------------------------

Private Sub Form_Load()

Combination "wxyz"

End Sub

--------------------------------------------------------------------------------------

其中GOWITH是真正的遞歸函數(shù),而Combination是用來預(yù)處理字符的

全局變量:

BUSE:用來確定是否使用過這個元素

lSTR:用來保存字符元素

NCOUNT:用來限制遞歸函數(shù)的深度,換句話說,就是輸出元素組中的元素個數(shù)

實(shí)際測試成功,另外我對前三題很感興趣,希望能夠傳給我

vb點(diǎn)虐 的兩道題

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))

VB.NET的題目哈 隨機(jī)產(chǎn)生20個大寫字母,求出現(xiàn)次數(shù)最多的字母及出現(xiàn)次數(shù),還有求出現(xiàn)次數(shù)為0的字母有哪些

Imports System.Text.RegularExpressions

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim a As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

Dim g() As Char = a.ToCharArray

Dim MyRandom As New Random

Dim bs As String = ""

For i = 1 To 20

bs = g(MyRandom.Next(0, g.GetUpperBound(0) + 1))

Next

Dim gs() As String = (From mt As Match In Regex.Matches(bs, "[A-Z]") Select mt.Value).ToArray

System.Array.Sort(gs)

gs = (From mt As Match In Regex.Matches(Join(gs, ""), "([A-Z])\1*") Select mt.Value).ToArray

Dim g_len() As Integer

g_len = (From mt As Match In Regex.Matches(Join(gs, ""), "([A-Z])\1*") Select mt.Length).ToArray ' 使用數(shù)組元素作為計(jì)數(shù)器g_len

System.Array.Sort(g_len, gs)

Label1.Text = "出現(xiàn)次數(shù)最多的字母:" gs(gs.GetUpperBound(0)).Substring(0, 1) " 共出現(xiàn)" g_len(g_len.GetUpperBound(0)) "次" vbCrLf "沒有出現(xiàn)的字母是:" Join(a.Split(bs.ToCharArray), "")

End Sub

End Class

文章題目:vb點(diǎn)虐 大題 vbnet implements
網(wǎng)頁鏈接:http://bm7419.com/article12/ddejigc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供小程序開發(fā)、標(biāo)簽優(yōu)化建站公司、靜態(tài)網(wǎng)站網(wǎng)頁設(shè)計(jì)公司、搜索引擎優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

營銷型網(wǎng)站建設(shè)