Skip to content

Instantly share code, notes, and snippets.

@dm4
Created May 7, 2012 05:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dm4/2626027 to your computer and use it in GitHub Desktop.
Save dm4/2626027 to your computer and use it in GitHub Desktop.
國二寫的人生第一隻程式
VERSION 5.00
Begin VB.Form Form1
Caption = "上推"
ClientHeight = 5415
ClientLeft = 60
ClientTop = 345
ClientWidth = 6930
LinkTopic = "Form1"
ScaleHeight = 5415
ScaleWidth = 6930
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton end
Caption = "結束"
Height = 615
Left = 4560
TabIndex = 13
Top = 3720
Width = 1575
End
Begin VB.CommandButton cls
Caption = "清除"
Height = 615
Left = 2760
TabIndex = 12
Top = 3720
Width = 1335
End
Begin VB.CommandButton go
Caption = "上推"
Height = 615
Left = 720
TabIndex = 11
Top = 3720
Width = 1335
End
Begin VB.TextBox x
Height = 495
Left = 3600
TabIndex = 8
Top = 2880
Width = 1335
End
Begin VB.TextBox d
Height = 615
Left = 5280
TabIndex = 3
Top = 1440
Width = 1695
End
Begin VB.TextBox c
Height = 615
Left = 3480
TabIndex = 2
Top = 1440
Width = 1815
End
Begin VB.TextBox b
Height = 615
Left = 1680
TabIndex = 1
Top = 1440
Width = 1815
End
Begin VB.TextBox a
Height = 615
Left = 0
TabIndex = 0
Top = 1440
Width = 1695
End
Begin VB.Label Label7
Caption = "A+B+C要小於D"
Height = 495
Left = 5400
TabIndex = 20
Top = 5040
Width = 1695
End
Begin VB.Label Label6
Caption = "B"
Height = 375
Left = 2520
TabIndex = 19
Top = 1200
Width = 735
End
Begin VB.Label Label5
Caption = "C"
Height = 375
Left = 4320
TabIndex = 18
Top = 1200
Width = 735
End
Begin VB.Label Label4
Caption = "D"
Height = 375
Left = 6120
TabIndex = 17
Top = 1200
Width = 735
End
Begin VB.Label Label3
Caption = "A"
Height = 375
Left = 720
TabIndex = 16
Top = 1200
Width = 735
End
Begin VB.Label Label2
Caption = "輸入數字"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2760
TabIndex = 15
Top = 360
Width = 1575
End
Begin VB.Label Label1
Caption = " 要上推 層"
Height = 495
Left = 2760
TabIndex = 14
Top = 3000
Width = 3135
End
Begin VB.Label f
Height = 495
Left = 4800
TabIndex = 10
Top = 2280
Width = 1335
End
Begin VB.Label e
Height = 495
Left = 3120
TabIndex = 9
Top = 2280
Width = 1095
End
Begin VB.Label dd
Height = 495
Left = 5400
TabIndex = 7
Top = 2160
Width = 1335
End
Begin VB.Label cc
Height = 495
Left = 3840
TabIndex = 6
Top = 2040
Width = 1335
End
Begin VB.Label bb
Height = 495
Left = 2040
TabIndex = 5
Top = 2040
Width = 1575
End
Begin VB.Label aa
Height = 495
Left = 480
TabIndex = 4
Top = 2040
Width = 1335
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cls_Click()
a = ""
b = ""
c = ""
d = ""
End Sub
Private Sub end_Click()
End
End Sub
Private Sub go_Click()
y = 0
x = Val(x)
Do While x <> y
If (Val(d) - Val(c) - Val(b) - Val(a)) Mod 2 = 1 Then
a = a * 2
b = b * 2
c = c * 2
d = d * 2
End If
e = Val(d) - Val(c) - Val(b) - Val(a)
f = e / 2
a = Val(a) + Val(f): b = Val(b) + Val(f): c = Val(c) + Val(f): d = Val(d) + Val(f)
aa = 0
bb = a
cc = Val(a) + Val(b)
dd = d
a = aa
b = bb
c = cc
d = dd
y = Val(y) + 1
e = ""
f = ""
aa = ""
bb = ""
cc = ""
dd = ""
Loop
a = Val(a) + 1
b = Val(b) + 1
c = Val(c) + 1
d = Val(d) + 1
End Sub
VERSION 5.00
Begin VB.Form down
Caption = "Form1"
ClientHeight = 5730
ClientLeft = 3375
ClientTop = 2295
ClientWidth = 7935
LinkTopic = "Form1"
ScaleHeight = 5730
ScaleWidth = 7935
Begin VB.TextBox label7
Height = 975
Left = 240
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 16
Top = 4680
Width = 7575
End
Begin VB.CommandButton Command2
Caption = "關閉"
Height = 615
Left = 5280
TabIndex = 11
Top = 3600
Width = 1575
End
Begin VB.CommandButton Command1
Caption = "清除"
Height = 615
Left = 3240
TabIndex = 10
Top = 3600
Width = 1455
End
Begin VB.TextBox d
Height = 375
Left = 5760
TabIndex = 4
Top = 720
Width = 1815
End
Begin VB.TextBox c
Height = 375
Left = 3960
TabIndex = 3
Top = 720
Width = 1575
End
Begin VB.CommandButton go
Caption = "開始算"
Height = 615
Left = 1200
TabIndex = 2
Top = 3600
Width = 1455
End
Begin VB.TextBox b
Height = 375
Left = 2040
TabIndex = 1
Top = 720
Width = 1695
End
Begin VB.TextBox a
Height = 375
Left = 240
TabIndex = 0
Top = 720
Width = 1575
End
Begin VB.Label Label9
Caption = "過程"
BeginProperty Font
Name = "細明體"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 18
Top = 4320
Width = 1335
End
Begin VB.Label Label8
Caption = "填入數字"
BeginProperty Font
Name = "華康POP1體W5"
Size = 18
Charset = 136
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3000
TabIndex = 17
Top = 120
Width = 1575
End
Begin VB.Label Label6
Height = 495
Left = 5880
TabIndex = 15
Top = 2280
Width = 1575
End
Begin VB.Label Label5
Height = 495
Left = 4080
TabIndex = 14
Top = 2280
Width = 1335
End
Begin VB.Label Label4
Height = 495
Left = 2280
TabIndex = 13
Top = 2280
Width = 1215
End
Begin VB.Label Label3
Height = 495
Left = 480
TabIndex = 12
Top = 2280
Width = 1335
End
Begin VB.Label cc
Height = 375
Left = 4080
TabIndex = 9
Top = 1320
Width = 1335
End
Begin VB.Label dd
Height = 375
Left = 5880
TabIndex = 8
Top = 1320
Width = 1575
End
Begin VB.Label bb
Height = 375
Left = 2160
TabIndex = 7
Top = 1320
Width = 1335
End
Begin VB.Label aa
Height = 375
Left = 360
TabIndex = 6
Top = 1320
Width = 1335
End
Begin VB.Label Label1
Caption = "0"
Height = 375
Left = 960
TabIndex = 5
Top = 3120
Width = 975
End
End
Attribute VB_Name = "down"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
a.Text = ""
c.Text = ""
d.Text = ""
b.Text = ""
aa.Caption = ""
bb.Caption = ""
cc.Caption = ""
dd.Caption = ""
Label1.Caption = 0
label7.Text = ""
Label3.Caption = ""
Label4.Caption = ""
Label5.Caption = ""
Label6.Caption = ""
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub go_Click()
aa.Caption = 1
bb.Caption = 1
cc.Caption = 1
dd.Caption = 1
Label3.Caption = a.Text
Label4.Caption = b.Text
Label5.Caption = c.Text
Label6.Caption = d.Text
label7.Text = label7.Text + a + "/" + b + "/" + c + "/" + d + "/"
Do While (dd.Caption > 0) Or (cc.Caption > 0) Or (bb.Caption > 0) Or (aa.Caption > 0)
aa.Caption = a.Text - b.Text
If (aa.Caption < 0) Then
aa.Caption = b.Text - a.Text
End If
bb.Caption = b.Text - c.Text
If (bb.Caption < 0) Then
bb.Caption = c.Text - b.Text
End If
cc.Caption = c.Text - d.Text
If (cc.Caption < 0) Then
cc.Caption = d.Text - c.Text
End If
dd.Caption = d.Text - a.Text
If (dd.Caption < 0) Then
dd.Caption = a.Text - d.Text
End If
If (dd.Caption > 0) Or (cc.Caption > 0) Or (bb.Caption > 0) Or (aa.Caption > 0) Then
Label1.Caption = Label1.Caption + 1
End If
a.Text = aa.Caption
b.Text = bb.Caption
c.Text = cc.Caption
d.Text = dd.Caption
label7.Text = label7.Text + "/" + aa + "/" + bb + "/" + cc + "/" + dd + "/"
Loop
Label1.Caption = Label1.Caption + 2
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment