坠入学考的深渊

VB

竞赛失利,再次成为了学考生,作为信息学竞赛生,当然要选信息技术了,那么就先从VB开始喽
虽然vb不区分大小写,并且还能自动排版,但是呢,写vb会经常写中文(虽然可以不打中文),所以中英文转化会非常的麻烦。
VB的语法其实和C++有类似之处,其实这些类似之处不止这两门语言之间,几乎所有语言之间都有共通之处,所以只要掌握了其中精髓,我们就可很快掌握一门语言。(但这依旧改变不了我蒟蒻的事实

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93

Private Sub Command1_Click()
Dim an As Integer
an = MsgBox("你确定要离开我吗?TAT", 1, "离开")
If an = 1 Then
'Exit Sub ' 退出事件
MsgBox "泪奔QAQ"
End
Else
MsgBox "乖~~~~"
End If

End Sub

Private Sub Command2_Click()
MsgBox "今天是" + Str(Date), 0, "提示日期"
End Sub


Private Sub Command3_Click()
Dim a As Integer, i As Integer, sum As Long, pro As Long
Dim flag As Boolean
a = Val(Text1.Text)
b = Val(Text2.Text)
For i = a To b Step 1
sum = sum + i
If sum >= 100000 Then flag = 1: Exit For
Next i

If flag = True Then
List1.AddItem "∑a~b 结果溢出"
Else
List1.AddItem "∑a~b" + Str(sum)
End If
pro = 1
sum = 1
i = a
Do While i <= b
i = i + 1
pro = pro * i
If pro >= 100000 Then flag = 1: Exit Do
Loop

If flag = True Then
List1.AddItem "∏a~b 结果溢出"
Else
List1.AddItem "∏a~b" + Str(pro)
End If
List1.AddItem "a*b的根号" + Str(Format$(Sqr(a * b), "0.00"))


End Sub
Private Sub Command4_Click()
Label1.Caption = ""
End Sub
Function gcd(a As Integer, b As Integer) As Integer

Do While b <> 0
Dim t As Integer
t = b
b = a Mod b
a = t
Loop
gcd = a
End Function


Private Sub Command5_Click()
Dim a As Integer, b As Integer
a = Val(Text1.Text)
b = Val(Text2.Text)
Label1.Caption = "最大公约数 " + Str(gcd(a, b))
End Sub



Private Sub Command6_Click()
Label1.BorderStyle = 0
End Sub

Private Sub Command7_Click()
Label1.BorderStyle = 1
End Sub

Private Sub Command8_Click()
Label1.Font = "隶书"

End Sub


Private Sub Command9_Click()
List1.Clear
End Sub