Redim Preserve Arr(10,n)
成都創(chuàng)新互聯(lián)是一家專注于成都網(wǎng)站設(shè)計、成都網(wǎng)站制作與策劃設(shè)計,嘉祥網(wǎng)站建設(shè)哪家好?成都創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設(shè)十年,網(wǎng)設(shè)計領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:嘉祥等地區(qū)。嘉祥做網(wǎng)站價格咨詢:18982081108
通過Preserve關(guān)鍵字定義的動態(tài)數(shù)組,可以更改數(shù)組arr最末維的大小,且保留數(shù)組arr原來各個元素的值。
所以答案為:C
例如:
Dim arr()
Redim arr(1 to 1,1 to 2)
arr(1,2) = "你好"
Redim Preserve arr(1 to 1, 1 to 3)
msgbox arr(1,2) '這個時候依然可以得到arr(1,2)的值為“你好”。
而且從答案來看,Redim只可能與Preserve聯(lián)合使用。其他都無法編譯!
上網(wǎng)收費:'Option Explicit
Dim t As Integer, f As Single, x As String
Private Sub Form_Load()
Text1.Text = ""
Label2 = ""
End Sub
Private Sub Command1_Click()
If Text1.Text = "" Then
Text1.SetFocus
MsgBox "請輸入上網(wǎng)時間"
Exit Sub
End If
t = Val(Text1.Text)
If t 120 Then
f = 0.06 * t + 2
Else
f = 0.06 * t * 0.85
End If
x = Str$(f) + "元"
Label2.Caption = x
Text1.SetFocus
End Sub
三角函數(shù):Private Sub Form_Load()
Text1.Text = ""
Label7.Caption = ""
End Sub
Private Sub Command1_Click()
Dim a, b As Double
Dim c As String
' Form2.Cls
If Text1.Text = "" Then
Text1.SetFocus
MsgBox "請輸入計算數(shù)據(jù)"
Exit Sub
End If
If Option4.Value = True Then
b = Val(Text1.Text) * 3.14 / 180
ElseIf Option5.Value = True Then
b = Val(Text1.Text)
End If
If Option1.Value = True Then
a = Sin(b)
c = "sin(" Text1.Text ")="
ElseIf Option2.Value = True Then
a = Cos(b)
c = "Cos(" Text1.Text ")="
ElseIf Option3.Value = True Then
a = Tan(b)
c = "Tan(" Text1.Text ")="
End If
a = Round(a, 6)
a = Format(a, "0.##########")
'If Left(a, 1) = "." Then
' a = "0" a
'ElseIf Left(a, 2) = "-." Then
' a = "-0" Right(a, Len(a) - 1)
'End If
Label7.Caption = c a
End Sub
打印幾何圖形:Private Sub Form_Load()
Picture1.FontSize = 16
End Sub
Private Sub Image1_Click()
Picture1.CurrentX = 0
Picture1.CurrentY = 0
For i = 0 To 5
Picture1.Print Tab(8 - i);
For j = 1 To 2 * i + 1
Picture1.Print "*";
Next j
Next i
End Sub
Private Sub Image2_Click()
Picture1.CurrentX = 0
Picture1.CurrentY = 0
For i = 0 To 5
Picture1.Print Tab(12 + i);
For j = 1 To 6
Picture1.Print "*";
Next j
Next i
End Sub
計算矩形周長面積:
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Label3.Caption = ""
End Sub
Private Sub Command1_Click()
If Text1.Text = "" Then
Text1.SetFocus
MsgBox "請輸入矩形的長"
Exit Sub
End If
If Text2.Text = "" Then
Text2.SetFocus
MsgBox "請輸入矩形的寬"
Exit Sub
End If
If Option1.Value = False And Option2.Value = False Then
MsgBox "請選擇計算類型"
Exit Sub
End If
s = Val(Text1.Text) * Val(Text2.Text)
l = 2 * (Val(Text1.Text) + Val(Text2.Text))
If Option1 = True Then
Label3.Caption = Str(s)
ElseIf Option2 = True Then
Label3.Caption = Str(l)
End If
End Sub
Private Sub Command2_Click()
Label3.Caption = ""
End Sub
Private Sub Command3_Click()
End
End Sub
計算器:Dim jsff
Dim f_num As Single
Private Sub Form_Load()
f_num = 0
jsff = ""
Text1.Text = ""
End Sub
Private Sub js()
Select Case jsff
Case "+"
f_num = f_num + Val(Text1.Text)
Case "-"
f_num = f_num - Text1.Text
Case "*"
f_num = f_num * Text1.Text
Case "/"
f_num = f_num / Text1.Text
Case "/"
f_num = f_num / Text1.Text
End Select
End Sub
Sub Command1_Click() '+
If Text1.Text = "" Then
Text1.SetFocus
Exit Sub
End If
If jsff = "" Then
f_num = Val(Text1.Text)
Else
js
End If
jsff = "+"
Text1.Text = ""
Text1.SetFocus
End Sub
Private Sub Command2_Click()
If Text1.Text = "" Then
Text1.SetFocus
Exit Sub
End If
If jsff = "" Then
f_num = Val(Text1.Text)
Else
js
End If
jsff = "-"
Text1.Text = ""
Text1.SetFocus
End Sub
Private Sub Command3_Click()
If Text1.Text = "" Then
Exit Sub
End If
If jsff = "" Then
f_num = Val(Text1.Text)
Else
js
End If
jsff = "*"
Text1.Text = ""
Text1.SetFocus
End Sub
Private Sub Command4_Click()
If Text1.Text = "" Then
Exit Sub
End If
If jsff = "" Then
f_num = Val(Text1.Text)
Else
js
End If
jsff = "/"
Text1.Text = ""
Text1.SetFocus
End Sub
Private Sub Command6_Click()
If Text1.Text = "" Then
Text1.SetFocus
Exit Sub
End If
x = Round(Sin(Val(Text1.Text)), 4)
If Left(x, 2) = "-." Then
x = "-0" Right(x, Len(x) - 1)
ElseIf Left(x, 1) = "." Then
x = "0" x
End If
Text1.Text = x
End Sub
Private Sub Command7_Click()
If Text1.Text = "" Then
Text1.SetFocus
Exit Sub
End If
x = Format(Round(Cos(Val(Text1.Text)), 4), "0.##########")
Text1.Text = x
End Sub
Private Sub Command8_Click()
If Val(Text1.Text) 0 Then
MsgBox "請不要對負數(shù)做開方運算"
Text1.SetFocus
Exit Sub
End If
x = Sqr(Val(Text1.Text))
If Left(x, 1) = "." Then x = "0" x
Text1.Text = x
End Sub
Private Sub Command9_Click()
If Text1.Text = 0 Then
MsgBox "請不要對0做倒數(shù)運算"
Text1.SetFocus
Exit Sub
End If
x = Val(1 / Text1.Text)
If Left(x, 2) = "-." Then
x = "-0" Right(x, Len(x) - 1)
ElseIf Left(x, 1) = "." Then
x = "0" x
End If
Text1.Text = x
End Sub
Private Sub Command5_Click()
If Text1.Text = "" And jsff = "" Then
Text1.SetFocus
Exit Sub
End If
If Text1.Text = "" And jsff = "+" Then
MsgBox "請輸入加數(shù)"
Text1.SetFocus
Exit Sub
ElseIf Text1.Text = "" And jsff = "-" Then
MsgBox "請輸入減數(shù)"
Text1.SetFocus
Exit Sub
ElseIf Text1.Text = "" And jsff = "*" Then
MsgBox "請輸入乘數(shù)"
Text1.SetFocus
Exit Sub
ElseIf Text1.Text = "" And jsff = "/" Then
MsgBox "請輸入除數(shù)"
Text1.SetFocus
Exit Sub
ElseIf Text1.Text = 0 And jsff = "/" Then
MsgBox "請不要用0做除數(shù)"
Text1.SetFocus
Exit Sub
End If
js
x = f_num
If Left(x, 2) = "-." Then
x = "-0" Right(x, Len(x) - 1)
ElseIf Left(x, 1) = "." Then
x = "0" x
End If
Text1.Text = x
jsff = ""
f_num = 0
End Sub
Private Sub Command10_Click()
Text1.Text = ""
f_num = 0
jsff = ""
Text1.SetFocus
End Sub
Private Sub Text1_Change()
End Sub
檢查體重:
'Option Explicit
Dim bz
Private Sub Form_Load()
bz = 0
End Sub
Private Sub Command1_Click()
If Text1.Text = "" Then
Text1.SetFocus
MsgBox "請輸入身高"
Exit Sub
End If
If Text2.Text = "" Then
Text2.SetFocus
MsgBox "請輸入體重"
Exit Sub
End If
If Option1.Value = False And Option2.Value = False Then
MsgBox "請選擇被檢測者性別"
Exit Sub
End If
If Option1 = True Then
x = Val(Text1.Text) - 100
ElseIf Option2 = True Then
x = Val(Text1.Text) - 105
End If
If Val(Text2.Text) x Then
Label3.Caption = "體重超標(biāo)"
Timer1.Enabled = True
Else
Label3.Caption = "體重正常"
Image2.Picture = Image1.Picture
End If
End Sub
Private Sub Timer1_Timer()
If bz = 1 Then
Image2.Picture = Image1.Picture
bz = 0
ElseIf bz = 0 Then
Image2.Picture = Image3.Picture
bz = 1
End If
End Sub
Private Sub Command2_Click()
Label3.Caption = ""
Timer1.Enabled = False
Image2.Picture = Image3.Picture
End Sub
Private Sub Command3_Click()
End
End Sub
小廣告:Dim bz
Private Sub Form_Load()
bz = 0
End Sub
Private Sub Command1_Click()
Label1.Visible = True
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
If Label1.Left 0 Then
Label1.Left = 6000
Else
Label1.Left = Label1.Left - 150
End If
If bz = 1 Then
Image3.Picture = Image1.Picture
bz = 0
ElseIf bz = 0 Then
Image3.Picture = Image2.Picture
bz = 1
End If
End Sub
診斷處方:Private Sub Form_Load()
Combo1.AddItem "輕微紅腫"
Combo1.AddItem "腫痛"
Combo1.AddItem "化膿"
Combo1.Text = Combo1.List(0) '設(shè)置combo1的默認選擇
Combo2.AddItem "輕度"
Combo2.AddItem "中度"
Combo2.AddItem "重度"
Combo2.AddItem "劇烈"
Combo2.AddItem "尖銳"
Combo2.Text = Combo2.List(0) '設(shè)置combo2的默認選擇
Combo3.AddItem "36度"
Combo3.AddItem "37度"
Combo3.AddItem "38度"
Combo3.AddItem "39度"
Combo3.AddItem "40度"
Combo3.Text = Combo3.List(0) '設(shè)置combo3的默認選擇
Combo4.AddItem "干咳"
Combo4.AddItem "有痰"
Combo4.AddItem "早起咳"
Combo4.Text = Combo4.List(0) '設(shè)置combo4的默認選擇
List1.AddItem "咽炎方" '設(shè)置列表框的可選項目
List1.AddItem "阿司匹林"
List1.AddItem "青霉素針劑"
List1.AddItem "感冒通"
List1.AddItem "維生素B"
List1.AddItem "維生素C"
List1.AddItem "喉片"
List1.Text = List1.List(0)
End Sub
Private Sub List1_DblClick()
List2.AddItem List1.Text
End Sub
Private Sub List2_DblClick()
List2.RemoveItem List2.ListIndex
End Sub
Private Sub Command1_Click()
Var$ = Combo1.Text + Combo2.Text + Combo3.Text + Combo4.Text
Select Case Var$
Case Is = "腫痛輕度38度干咳"
Text1.Text = "咽炎"
Case Is = "化膿中度39度早起咳"
Text1.Text = "扁桃體發(fā)炎"
Case Is = "化膿重度40度有痰"
Text1.Text = "肺炎"
Case Else
Text1.Text = "重選"
End Select
End Sub
Private Sub Command3_Click()
For i = 0 To List2.ListCount - 1
If i = List2.ListCount Then
Exit Sub
ElseIf List2.Selected(i) Then
List2.RemoveItem i
i = -1
End If
Next i
End Sub
Private Sub Command2_Click()
End
End Sub
VB的運算順序是:先乘除、后加減,有括號的先算括號內(nèi),有負號的先算負號。
請你比較一下這個運算中x和y的值:
Dim n As Single = 4
Dim x As Single
Dim y As Single
x = n + 1
x = x / n
x = x - 1
x = Math.Sqrt(x)
y = Math.Sqrt((n + 1) / n - 1)
這樣就會發(fā)現(xiàn),你的代碼中括號的位置錯了。
正確的應(yīng)該是: Math.Sqrt((n + 1) / n - 1)
1.在安全模式下用戶可以輕松地修復(fù)系統(tǒng)的一些錯誤,起到事半功倍的效果。啟動計算機,必須在系統(tǒng)顯示windows啟動畫面前,按f8鍵,就可以進入計算機的安全模式。
2.bois是一個用于修改cmos ram參數(shù)程序。啟動計算機時,按del鍵可以進入bios程序菜單,修改cmos參數(shù)。
3.windows XP操作系統(tǒng)是用于運行和管理整個計算機的軟硬資源的系統(tǒng)軟件,屬于多用戶多任務(wù)的操作系統(tǒng)。
4.決定微機整體性能的物理部件有主板、內(nèi)存、顯卡、處理器,除了這些部件以外,主板芯片組部件決定著整個機器的穩(wěn)定性。
5.目前,計算機上配置的顯卡分為集成顯卡和獨立顯卡,其中獨立顯卡性能更好。
6.說出5種使用USB接口的微機常用設(shè)備鍵盤、鼠標(biāo)、打印機、掃描儀、u盤
7.預(yù)防病毒的主要措施有:--。--。--。--。--
8.目前,計算機上的內(nèi)存類型是sdram、ddr ram和rddam一般來說,內(nèi)存越大,數(shù)據(jù)處理能力越強。
9.復(fù)制當(dāng)前窗口,必須先按住alt鍵,然后按住print鍵。復(fù)制整個屏幕需要按住print鍵
10.正常情況下,啟動計算機都是從c盤啟動的,需要從光盤啟動的計算機必須要進行bios設(shè)置