- 博客(13)
- 收藏
- 关注
原创 n*1并输出于文件中
Private Sub Command1_Click() Cls Dim i As Long Dim L As Long Dim r() As Byte Dim a() As Byte Dim b As String Dim c As Byte L = Len(Me.Text1.Text) ReDim a(L) For i = 1 To L b = Mid(Me.Te
2016-04-21 17:07:58 216
原创 十的阶乘
Private Sub Command1_Click() Cls Print 阶乘(10) End Sub Private Function 阶乘(n As Integer) As Long If n = 1 Then 阶乘 = 1 Else 阶乘 = n * 阶乘(n - 1) End If End Function
2016-04-14 17:35:22 356
原创 余数和商
Option Base 1 Private Sub Command1_Click() Dim yushu As Byte Dim shang As Byte Dim n2() As Byte Dim n1() As Byte Dim n1len As Long Dim n2len As Long Dim i As Long Dim tempresult As Byte n1le
2016-04-14 17:27:02 529
原创 用计时器计算1至100的和
Option Explicit Dim i As Integer Dim sum As Integer Private Sub Command1_Click() Cls Font.Size = 70 End Sub Private Sub Timer1_Timer() sum = sum + i i = i + 1 If i > 100 Then Me.Timer1.Enab
2016-04-14 16:36:10 280
原创 余数和商
Private Sub Command1_Click() Dim n1 As Byte Dim n2 As Byte Dim yushu As Byte Dim shang As Byte Dim tempresult As Byte n1 = Int(Val(Me.Text1.Text)) n2 = Int(Val(Me.Text2.Text)) tempresult = n1
2016-04-14 16:31:53 372
原创 十个随机数相加
1. Option Explicit Private Sub Command1_Click() Cls Dim i As Integer, Sum As Integer Dim a(10) As Integer Randomize For i = 1 To 10 a(i) = Int(Rnd * 1000) + 1 Sum = Sum + a(i) Next i Print
2016-04-07 16:27:54 248
原创 c语言与vb
这两种语言都属于编程语言,但对我来说使用起来却是两种完全不同的感受,使用C语言就感觉我可以熟练的驾驭它,但在vb却是完全不同的体验。 在C语言中我可以自己编译简单的程序,但是在vb我却只能机械的输入现成的语句。仔细想想不难发现在C语言中我理解其中的每个语句,而在VB中我完全不懂每句话存在的意义,在我看来C语言中语句拥有更强的逻辑性以及更短的语句所带来更简单的理解性,这也可能是C语
2016-03-31 17:16:43 2712
原创 n个随机数排列
Option Base 1 Private Sub Command1_Click() Cls Dim x As Integer x = Int(Val(Me.Text1.Text)) Dim n As Integer Dim A() As Integer ReDim A(x) n = LBound(A)
2016-03-31 17:05:22 377
原创 15个随机数排序
Private Sub cmdSort_Click() Dim A(14) As Integer Dim I, J As Integer Dim Temp As Integer Form1.Cls Randomize For I = 0 To 14 A(I) = Int(Rnd * 1000) Next I For I = 0
2016-03-24 17:44:45 515
原创 随机数由小到大排序
Private Sub Command1_Click() Cls Me.Font.Size = 50 Dim b As Integer, c As Integer Dim d As Integer c = Int(Rnd() * 1000) b = Int(Rnd() * 1000) Print "b=" & b Print "c=" & c d = c c = b b
2016-03-24 17:42:36 522
原创 两个随机数排序
Private Sub Command1_Click() Cls Me.Font.Size = 50 Dim a As Integer Dim b As Integer Dim swap As Integer a = Int(Rnd * 1000) b = Int(Rnd * 1000) If a
2016-03-24 17:41:03 275
原创 交换
方法一: Private Sub Command3_Click() Dim a As String a = Text1.Text Text1.Text = Text2.Text Text2.Text = a End Sub Private Sub Text1_Change() Text1.BackColor = vbBlack Text1.ForeColor = vb
2016-03-17 17:28:21 172
原创 变量代换
Private Sub Command1_Click() Cls Dim b As Integer, c As Integer Dim d As Integer c = Int(Rnd() * 1000) b = Int(Rnd() * 1000) Print "b=" & b Print "c=" & c d = c c = b b = d
2016-03-17 17:06:47 583
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人