文档详情

第四章实习训练.doc

发布:2017-02-19约18.29万字共47页下载文档
文本预览下载声明
例4-1 Private Sub Command1_Click() Print Tab(26); * Print Tab(25); *** Print Tab(24); ****** Print Tab(23); ******** Print Tab(22); ********** Print Tab(21); ************ Print Tab(20); ************** Print Tab(19); **************** End Sub Private Sub Command1_Click() Picture1.Print Tab(21); * Picture1.Print Tab(20); *** Picture1.Print Tab(19); ****** Picture1.Print Tab(18); ******** Picture1.Print Tab(17); ********** End Sub 例4-2 Private Sub Command1_Click() Dim x%, y%, h%, f% f = 16: h = 40 x = (4 * f - h) / 2 y = (h - 2 * f) / 2 Label1.Caption = 若总头数为 f ,总脚数为 h ,则 Chr(10) 鸡有 x 只, 兔有 y 只 End Sub 例4-3 Private Sub Command1_Click() Dim x%, y%, h%, f% f = 16: h = 40 x = (4 * f - h) / 2 y = (h - 2 * f) / 2 Label1.Caption = 若总头数为 f ,总脚数为 h ,则 Chr(10) 鸡有 x 只, 兔有 y 只 End Sub Private Sub Command2_Click() Dim x%, y%, h%, f% 上面有同样的,为什么这一段不可以省略??? f = 16: h = 40 上面有同样的,为什么这一段不可以省略??? x = (4 * f - h) / 2 y = (h - 2 * f) / 2 不加那一段的效果 Open d:\out.text For Output As #1 不加那一段的效果 Write #1, x, y Close #1 End Sub 例4-4 Private Sub Command1_Click() Dim h%, f%, x%, y% h = InputBox(请输入总头数, 鸡兔同笼, 0) f = InputBox(请输入总脚数, 鸡兔同笼, 0) x = (4 * h - f) / 2 y = (f - 2 * h) / 2 Print Print Print Print Print Tab(12); 若总头数为 h ;若总脚数为 f ,则 Print Tab(12); 鸡有 x 只 Print Tab(12); 兔有 y 只 End Sub 例4-5 Private Sub Command1_Click() Dim h%, f% h = Val(Text1.Text): f = Val(Text2.Text) x = (4 * h - f) / 2 y = (f - 2 * h) / 2 Label3.Caption = The Result: There are x chicken and Chr(10) y rabbits. End Sub 例4-6 Private Sub Command1_Click() Dim x%, y%, h%, f%, z$ Open d:\寂寞的王ZZZ\out.txt For Input As #1 Input #1, x, y Close #1 f = (x + y) * 4 h = x + y z = MsgBox(The total number of head is h Chr(10) and the total pin count is f, , The Result) End Sub 例4-7 Private Sub Command1_Click() Dim x$, y$ x =
显示全部
相似文档