VB字符出現(xiàn)最多字符以及次數(shù)數(shù)統(tǒng)計(jì)_第1頁(yè)
VB字符出現(xiàn)最多字符以及次數(shù)數(shù)統(tǒng)計(jì)_第2頁(yè)
VB字符出現(xiàn)最多字符以及次數(shù)數(shù)統(tǒng)計(jì)_第3頁(yè)
VB字符出現(xiàn)最多字符以及次數(shù)數(shù)統(tǒng)計(jì)_第4頁(yè)
VB字符出現(xiàn)最多字符以及次數(shù)數(shù)統(tǒng)計(jì)_第5頁(yè)
全文預(yù)覽已結(jié)束

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、1,文本出現(xiàn)字符次數(shù)最多的字母,及出現(xiàn)的次數(shù)Dim a(1 To 26) As Integer Dim max As Integer n = Len(s) For i = 1 To n k = Asc(Mid$(s, i, 1) If (k >= 65 And k <= 90) Then a(k - 64) = a(k - 64) + 1 End If If (k >= 97 And k <= 122) Then a(k - 96) = a(k - 96) + 1 End If Next max = 0 For m = 1 To 26 If max < a(m)

2、Then max = a(m) End If Next Text2 = max For m = 1 To 26 If a(m) = max Then l = m End If Next Text1 = Chr(l + 64)2,打印出菱形Private Sub Form_Click() For i = 1 To 5 For j = 1 To 6 - i Print " " Next j For j = 1 To 2 * i - 1 Print "*" Next j Print Next i For i = 1 To 4 For j = 1 To i +

3、1 Print " " Next j For j = 1 To (9 - 2 * i) Print "*" Next j Print Next iEnd Sub3,最長(zhǎng)單詞的長(zhǎng)度,以該長(zhǎng)度最后一次出現(xiàn)的單詞是?Option Base 1Dim s As StringPrivate Sub Command1_Click() Open App.Path & "in5.dat" For Input As #1 s = Input(LOF(1), #1) Close #1End SubPrivate Sub Command2_Clic

4、k()'需考生編寫(xiě)幫我解釋一下一下的代碼:Dim s as stringFor i = 1 To Len(s) J = Asc(Mid(s, i, 1) Select Case J Case 48 To 57, 65 To 90, 97 To 122 Case Else Mid(s, i, 1) = "-" End Select Next i J = Len(s) - 1 For i = 1 To J If Mid(s, i, 1) = "-" And Mid(s, i + 1, 1) = "-" Then s = Left(

5、s, i) + Right(s, J - i) J = J - 1 i = i - 1 End If Next i s = Left(s, Len(s) - 1) R = Split(s, "-") B = R(0) For i = 1 To UBound(R) If Len(B) < Len(R(i) Then B = R(i) Next i For m = UBound(R) To 1 Step -1 If Len(B) = Len(R(m) Then Exit For End If Next Text1.Text = Len(B) Text2.Text = R(

6、m)End SubPrivate Sub Form_Unload(Cancel As Integer) Open App.Path & "out5.dat" For Output As #1 Print #1, Text1.Text, Text2.Text Close #1End Sub4,結(jié)構(gòu)類(lèi)型數(shù)據(jù)題目Private Type Recordtype myname As String * 10 a1 As Integer a2 As Integer a3 As IntegerEnd TypeDim maxval%, minval%Private Sub Comma

7、nd1_Click() '=考生應(yīng)完成的程序(開(kāi)始)= Dim s As Recordtype Open "in5.dat" For Random As #1 Len = Len(s) maxval = 0 minval = 300 For k = 1 To 20 Get #1, , s sumval = s.a1 + s.a2 + s.a3 If sumval > maxval Then maxval = sumval If sumval < minval Then minval = sumval Next k Close #1'=考生應(yīng)完成的

8、程序(結(jié)束)=End SubPrivate Sub Command2_Click() Open App.Path & "out5.dat" For Output As #1 Print #1, maxval% Print #1, minval% Close #1End SubDim a(5, 40)Private Sub Command1_Click() Dim ch As String ch$ = "" Open App.Path & "in5.dat" For Input As #1 For i = 1 To 5

9、For j = 1 To 40 Input #1, a(i, j) ch = ch & a(i, j) & " " Next j ch = ch & Chr(13) & Chr(10) Next i Close #1 Text1.Text = chEnd SubPrivate Sub Command2_Click() '=考生編寫(xiě)的程序= For i = 1 To 5 Max = -100 Sum = 0 n = 0 For j = 1 To 40 If a(i, j) Mod 2 = 0 Then If Max < a(i, j) Then Max = a(i, j) Else Sum = Sum + a(i, j) n = n + 1 End If Next j Label1(i - 1).Caption = Max Text2(i - 1).Text = Int(Sum / n * 100) / 100 Next i '=End SubPrivate Sub Command3_Click() Open

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論