急!!几道Vb题 在线等......
1.为什么Dima(n,n)AsInteger不对?2.Constn=-5:M=6Dima(nToM)Fori=LBound(a,1)ToUBound(a,1)a(i)=...
1.为什么 Dim a(n,n) As Integer 不对?
2.Const n=-5:M=6
Dim a(n To M)
For i=LBound(a,1) To UBound(a,1)
a(i)=i
Next i
Print a(LBound(a,1));a(UBound(a,1))
执行结果是? 具体怎么做啊?
3.下面不是合法的整常数的是()
A。30 B.&O300 C.&H 300 D.%300
为什么?
4.以下关系表达式中,其值为False的是()
A."ABC">"AbC" B.“男">"女" 为什么? 展开
2.Const n=-5:M=6
Dim a(n To M)
For i=LBound(a,1) To UBound(a,1)
a(i)=i
Next i
Print a(LBound(a,1));a(UBound(a,1))
执行结果是? 具体怎么做啊?
3.下面不是合法的整常数的是()
A。30 B.&O300 C.&H 300 D.%300
为什么?
4.以下关系表达式中,其值为False的是()
A."ABC">"AbC" B.“男">"女" 为什么? 展开
2个回答
展开全部
第一题:
'华氏温度和设置温度的转换关系: 5(℉- 32)= 9(℃)
'新建工程,添加窗体Form1,并添加两个Lable控件,两个Textbox控件,两个CommandButton控件
'两个Lable的Caption属性分别为:
'Caption属性分别为:"摄氏温度(℉):" 和 "华氏温度(℃):"
'两个CommandButton控件Caption属性分别为:
'"摄氏转华氏"和"华氏转摄氏"
Dim F As Double
Dim C As Double
Private Sub Command1_Click()
If IsNumeric(Text1.Text) Then
F = Val(Text1.Text)
Text2.Text = 9 * F / 5 + 32
Else
MsgBox "请输入纯数字!", vbOKOnly, "提示"
Text1.Text = ""
End If
End Sub
Private Sub Command2_Click()
If IsNumeric(Text2.Text) Then
C = Val(Text2.Text)
Text1.Text = 5 * (C - 32) / 9
Else
MsgBox "请输入纯数字!", vbOKOnly, "提示"
Text2.Text = ""
End If
End Sub
Private Sub Form_Load()
Me.Caption = "温度转换"
End Sub
第二题:
'三个TextBox,三个Lable,两个CommandButton
Dim a, b, c As Double
Dim P As String
Private Sub Command1_Click()
If IsNumeric(Text1.Text) And IsNumeric(Text2.Text) And IsNumeric(Text3.Text) Then
a = Val(Text1.Text)
b = Val(Text2.Text)
c = Val(Text3.Text)
If a + b > c And Abs(a - b) < c Then
P = "一般三角形!"
If a = b Or a = c Or b = c Then
P = "等腰三角形!"
If a = b = c Then
P = "等边三角形!"
End If
ElseIf a * a + b * b = c * c Or a * a + c * c = b * b Or b * b + c * c = a * a Then
P = "直角三角形!"
End If
Else
P = "不够成三角形!"
End If
MsgBox "经判断此三角形为: " & P, vbOKOnly, "三角形判断"
Else
MsgBox "请正确输入数字!", vbOKOnly, "三角形判断"
Text1.SetFocus
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Me.Caption = "三角形判断"
Label1.Caption = "第一条边长度:"
Label2.Caption = "第二条边长度:"
Label3.Caption = "第三条边长度:"
Command1.Caption = "判 断"
Command2.Caption = "退 出"
End Sub
第三题
'新建两个Label
Function DoString(strings As String)
If strings <> "" Then
Dim P As Integer, q As Integer, S As String
P = Len(strings)
For q = 1 To P
'在立即窗口中显示,如果想在其它地方比如text中显示改为
S = Right(Left(strings, q), 1)
Label1.Caption = Label1.Caption & " " & S
Label2.Caption = Label2.Caption & " " & Asc(S)
Next q
End If
End Function
Private Sub Form_Load()
Me.Caption = "字符与Ascii码转换"
Label1.Caption = "输入的字符为:"
Label2.Caption = "转换成ASCII为:"
Dim strings As String
strings = InputBox("输入字符串:", "请输入", "Hello!")
DoString (strings)
End Sub
'华氏温度和设置温度的转换关系: 5(℉- 32)= 9(℃)
'新建工程,添加窗体Form1,并添加两个Lable控件,两个Textbox控件,两个CommandButton控件
'两个Lable的Caption属性分别为:
'Caption属性分别为:"摄氏温度(℉):" 和 "华氏温度(℃):"
'两个CommandButton控件Caption属性分别为:
'"摄氏转华氏"和"华氏转摄氏"
Dim F As Double
Dim C As Double
Private Sub Command1_Click()
If IsNumeric(Text1.Text) Then
F = Val(Text1.Text)
Text2.Text = 9 * F / 5 + 32
Else
MsgBox "请输入纯数字!", vbOKOnly, "提示"
Text1.Text = ""
End If
End Sub
Private Sub Command2_Click()
If IsNumeric(Text2.Text) Then
C = Val(Text2.Text)
Text1.Text = 5 * (C - 32) / 9
Else
MsgBox "请输入纯数字!", vbOKOnly, "提示"
Text2.Text = ""
End If
End Sub
Private Sub Form_Load()
Me.Caption = "温度转换"
End Sub
第二题:
'三个TextBox,三个Lable,两个CommandButton
Dim a, b, c As Double
Dim P As String
Private Sub Command1_Click()
If IsNumeric(Text1.Text) And IsNumeric(Text2.Text) And IsNumeric(Text3.Text) Then
a = Val(Text1.Text)
b = Val(Text2.Text)
c = Val(Text3.Text)
If a + b > c And Abs(a - b) < c Then
P = "一般三角形!"
If a = b Or a = c Or b = c Then
P = "等腰三角形!"
If a = b = c Then
P = "等边三角形!"
End If
ElseIf a * a + b * b = c * c Or a * a + c * c = b * b Or b * b + c * c = a * a Then
P = "直角三角形!"
End If
Else
P = "不够成三角形!"
End If
MsgBox "经判断此三角形为: " & P, vbOKOnly, "三角形判断"
Else
MsgBox "请正确输入数字!", vbOKOnly, "三角形判断"
Text1.SetFocus
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Me.Caption = "三角形判断"
Label1.Caption = "第一条边长度:"
Label2.Caption = "第二条边长度:"
Label3.Caption = "第三条边长度:"
Command1.Caption = "判 断"
Command2.Caption = "退 出"
End Sub
第三题
'新建两个Label
Function DoString(strings As String)
If strings <> "" Then
Dim P As Integer, q As Integer, S As String
P = Len(strings)
For q = 1 To P
'在立即窗口中显示,如果想在其它地方比如text中显示改为
S = Right(Left(strings, q), 1)
Label1.Caption = Label1.Caption & " " & S
Label2.Caption = Label2.Caption & " " & Asc(S)
Next q
End If
End Function
Private Sub Form_Load()
Me.Caption = "字符与Ascii码转换"
Label1.Caption = "输入的字符为:"
Label2.Caption = "转换成ASCII为:"
Dim strings As String
strings = InputBox("输入字符串:", "请输入", "Hello!")
DoString (strings)
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询