ictr.cn:急求:VB编程,很简单的,随便帮我做一下就行了。拜托!

来源:百度文库 编辑:高校问答 时间:2024/05/02 19:26:21
1.从键盘输入三个数,判断能否以此三个数为边长 组成三角形.
2.从键盘输入一个数,判断此数是否为偶数。
3.从键盘输入M个数(M也从键盘输入),从中找出最大的数并输出到荧幕上。

任选,as soon as possible.现在这拜过。
再加两个:
1把字符作如下分类:大写字母:A-Z、小写字母:a-x、数字:0-9、其它字符。根据此分类方法,从键盘输入一个字符,输出该字符类型。
5.已知s=2+4+6+...+n,试找出一个最大整数n,使s<25000

第一题:
Private Sub Command1_Click()
On Error GoTo ErrorHandle:
Dim a As Single, b As Single, c As Single
Dim Max As Single, Mid As Single, Min As Single

a = InputBox("输入边长A", "输入")
b = InputBox("输入边长B", "输入")
c = InputBox("输入边长C", "输入")

If a + b > c And a + c > b And b + c > a Then
MsgBox "OK"
Else
MsgBox "不能组成三角形"
End If

ErrorHandle:
End Sub

第二题:
Private Sub Command2_Click()
On Error GoTo ErrorHandle:
Dim a As Integer

a = InputBox("输入数字", "输入")

If a Mod 2 = 0 Then
MsgBox "偶数"
Else
MsgBox "奇数"
End If
ErrorHandle:
End Sub

第三题:
Private Sub Command3_Click()
On Error GoTo ErrorHandle:

Dim Max As Single
Dim M As Integer
Dim i As Integer
Dim TmpSng As Single

M = InputBox("输入M的个数", "输入")

Max = 0
For i = 1 To M
TmpSng = InputBox("输入第" & i & "个数字", "输入")
If TmpSng > Max Then
Max = TmpSng
End If
Next

MsgBox "得到的最大数字是" & Max
ErrorHandle:
End Sub

以上程序在Win 2000 Server +VB6.0 下通过

第2题
Dim n%

Private Sub Form_Click()
If n Mod 2 = 0 Then
Print n
End If
If n Mod 2 = 1 Then
Print "该数不是偶数"
End If

End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
n = Text1.Text
End If
End Sub

我也想学呀