[分享]_5+6指派第一個moto回家作業CODE ANSWER

5+6派的VB還真是傷腦筋

TOTAL花了我好久(其實都在搞西搞東= =)

此為100分的程式碼(如果沒手殘打錯…)

包含select case的架構

但是…請自己小心本人有留一腿…(不是那種很簡單的註解招式)

看仔細記得修改,別傻傻的ctrl+c,ctrl+v………….Good Luck!

不囉唆

程式碼奉上!

//Program Code Start!

Private Sub Command1_Click()

MsgBox “Project By Nathaniel 2008/10/02”

End

End Sub

Private Sub Command2_Click()

Cls

QB.Caption = “Q1”

End Sub

Private Sub QB_Click()

h = QB.Caption

Select Case h

‘========================================================

Case “Q1”

Cls

Print “Question 1”

Print “~~~~~~~~~~~~~~~~”

‘a

‘a

‘a

‘a

‘a

‘….20 LINE

For d = 1 To 20

Print “A”

Next d

QB.Caption = “Q2”

‘========================================================

Case “Q2”

Cls

Print “Question 2”

Print “~~~~~~~~~~~~~~~~”

‘AAAAA

‘5X4 A

For i = 0 To 3

  For j = 0 To 4

Print “A”;

Next j

Print

Next i

QB.Caption = “Q3”

‘========================================================

Case “Q3”

Cls

Print “Question 3”

Print “~~~~~~~~~~~~~~~~”

‘A   A   A   A   A

‘5X4 A

For i = 0 To 3

  For j = 0 To 4

Print “A   “;

Next j

Print

Next i

QB.Caption = “Q4”

‘========================================================

Case “Q4”

Cls

Print “Question 4”

Print “~~~~~~~~~~~~~~~~”

‘1

‘2

‘3

‘4

‘5

For n = 1 To 5

Print n

Next n

QB.Caption = “Q5”

‘========================================================

Case “Q5”

Cls

Print “Question 5”

Print “~~~~~~~~~~~~~~~~”

‘1

’12

‘123

‘1234

‘12345

For i = 1 To 5

T = “”

  For j = 1 To i

T = T & j

Next j

Print T

Next i

QB.Caption = “Q6”

‘========================================================

Case “Q6”

Cls

Print “Question 6”

Print “~~~~~~~~~~~~~~~~”

‘54321

‘4321

‘321

’21

‘1

For i = 5 To 1 Step -1

g = “”

  For j = i To 1 Step -1

   g = g & j

Next j

Print g

Next i

QB.Caption = “Q7”

‘========================================================

Case “Q7”

Cls

Print “Question 7”

Print “~~~~~~~~~~~~~~~~”

‘1+2=3

‘2+3=5

‘3+4=7

‘到10+11 = 21

 

For F = 1 To 10

Print F & “+” & (F + 1) & “=” & (F * 2 + 1)

Next F

QB.Caption = “Q8”

‘========================================================

Case “Q8”

Cls

Print “Question 8”

Print “~~~~~~~~~~~~~~~~”

‘1+2=3

‘2+4=6

‘4+7=11

‘7+11=18

’22+ ?? = ???

k = 1

Q = 1

For T = 1 To 7

  Q = Q + T

Print k; “+”; Q; “=”; k + Q

k = k + T

Next T

QB.Caption = “Q9”

‘========================================================

第九題保留…這樣才不會太多人滿分:)

‘========================================================

Case “Q10”

Cls

Print “Question 10”

Print “~~~~~~~~~~~~~~~~”

orz = 1

For i = 1 To 10

   Print i & “!=” & i * orz

   orz = orz * i

Next i

QB.Caption = “QE”

‘========================================================

Case “QE”

Cls

Print “Question End”

Print “~~~~~~~~~~~~~~~~”

Print “重來?(Go To Question 1)”

QB.Caption = “Q1”

End Select

End Sub

‘Edit by Nathaniel

 

1 Comment

  1. 不愧是神手
    不過 註解好多
    哈哈xD
    版主回覆:(11/29/2011 08:05:33 AM)
    過獎過獎…
    方大師才是神手(笑)

Leave a comment

這個網站採用 Akismet 服務減少垃圾留言。進一步瞭解 Akismet 如何處理網站訪客的留言資料