- 博客(16)
- 收藏
- 关注
原创 随机生成10个整数
Dim a(1 To 10) As IntegerPrivate Sub Command1_Click() Form_LoadEnd Sub Private Sub Form_Load() Dimp As String 'p用来显示随机生成的10个数 Randomize p = "" Fori = 1 To 10 '生成10个随机整数
2012-06-02 14:07:50
2645
原创 随机生成十个不重复的整数
第一篇:Private Sub Form_Load()Me.FontSize = 18Dim a(100) As Integer, b(100) As IntegerDim i As Integer, j As Integer, k AsIntegerForm1.AutoRedraw = TrueRandomizeFor i = 1 To 100a(i) = i
2012-06-02 14:06:54
1285
原创 判断整除并求和
Private Sub Command1_Click()Dim m As Integer, n As Integer, d AsIntegerDim s As Long '保存结果m = Val(Text1.Text)n = Val(Text2.Text)d = Val(Text3.Text)s = 0sum m, n, d, sLabel4.Caption = m
2012-06-02 14:05:24
396
原创 10个数的比较
Private Sub Command1_Click()Dim a As IntegerDim b As IntegerDim c As IntegerDim d As IntegerDim e As IntegerDim f As IntegerDim g As IntegerDim h As IntegerDim i As IntegerDim j As
2012-06-02 14:04:30
360
原创 温标转换
Option ExplicitPrivate Sub Command1_Click() '摄氏→华氏If Trim(Text1.Text) = "" Then Text1.Text = "0"'调用自定义函数Label3.Caption = transth(Val(Text1.Text), True)Label4.Caption = "摄氏度"Label5.Caption
2012-05-07 19:27:00
549
原创 求100以内的素数的和
Private Sub Command1_Click() Dim s As Integer, n As Integer s = 0: n = 1 Do While n If IsPrimer(n) s = s + n End If n = n + 1 Loop
2012-04-22 12:55:22
560
原创 判断一个数是否是素数
Private Function IsPrimer(n As Integer) As Integer Dim i As Integer For i = 2 To n - 1 If n Mod i = 0 Then Exit For End If Next i I
2012-04-22 12:54:33
312
原创 计算你的出生日期是星期几
Private Sub Command1_Click()Dim Year As IntegerDim Month As IntegerDim Day As IntegerDim dayofweek As ByteDim Birthday As DateYear = Int(Val(Text1.Text))Month = Int(Val(Text2.Text))Day
2012-04-22 12:52:17
779
原创 能同时被17和37整除的数
Private Sub Command1_Click() Dim index As Integer For index = 1000 To 2000 Step 1 If Is17and37ZhengChu(index) = True Then Print Str(index) End If Next ind
2012-04-22 12:50:12
715
原创 几位数乘法的结构
Option Base 1 Private Sub Command1_Click() Dim M As String Dim N As String M = Trim(Text1.Text) N = Trim(Text2.Text) Dim Number1() As Byte Dim Number2() A
2012-04-09 18:38:32
360
原创 实现能动的图形
Private Sub Form_Load()Timer1.Interval = 70End SubPrivate Sub Timer1_Timer()Timer1.Enabled = FalseIf Picture1.Left + Picture1.Width Then Picture1.Left
2012-04-09 18:34:53
248
原创 随机图形
Private Sub Form_Load()Command1.Caption = "随机画圆"Command2.Caption = "随机文字"Command3.Caption = "立体图形"Command4.Caption = "随机图像"Command5.Caption = "退出"Form1.ScaleMode = 1Pictu
2012-04-09 18:31:54
374
原创 单精度和双精度
浮点数(float)又称作浮点数,是属于有理数中某特定子集的数的数字表示,在计算机中用以近似表示任意某个实数。具体来说,这个实数由一个整数或定点数(即尾数)乘以某个基数(计算机中通常是2)的整数次幂得到,这种表示方法类似于基数为10的科学记数法。浮点计算是指浮点数参与的运算,这种运算通常伴随着因为无法精确表示而进行的近似或舍入。一个浮点数a由两个数m和e来表示:a = m × be。在任意
2012-04-09 18:30:37
2359
原创 分析它是不是素数
Private Sub Command1_Click() Dim M As Integer Dim N As Integer Dim flag As Boolean M = Int(Val(Text1.Text)) N = M - 1 flag = False '为true时表示M可被比它小的整数整除' While N >= 2
2012-04-09 18:20:06
246
原创 制作秒表
Private Sub Command1_Click()Timer1.Enabled = TrueEnd Sub Private Sub Timer1_Timer()Label1.Caption = TimeEnd Sub 注:如果Label1.Caption=Now,则会出现年月日
2012-04-09 18:19:15
411
原创 计算两数之间的最大公约数
Option ExplicitPrivate Sub Command1_Click() Dim M As Integer Dim N As Integer M=Int(Val(Text1.Text)) N=Int(Val(Text2.Text)) Dim TemporyValue As Integer If M=N Then
2012-04-09 18:17:28
368
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人