VB编程题目
第五题OptionExplicit'-------------------------------------------------------'【程序填空】'----...
第五题Option Explicit
'-------------------------------------------------------
'【程序填空】
'-------------------------------------------------------
'题目:写出程序运行后,单击窗体,Form1上显示的内容
' sum 函数的功能为求阶乘和
' isum = 1
' isum = 3
' isum = 6
' isum = 10
' isum = 15
'请在【?】处填入正确的内容
'-------------------------------------------------------
'
Private Sub Form_Click()
Dim I As Integer, isum As Integer
'**********SPACE**********
For I = 1 To 【5】
isum = sum(I)
'**********SPACE**********
Form1.Print "isum="; 【sum(I); 】
Next I
End Sub
Private Function sum(n As Integer)
Static j As Integer
'**********SPACE**********
【?】 j + n
sum = j
End Function
第六题Option Explicit
'-------------------------------------------------------
'【程序填空】
'-------------------------------------------------------
'题目:窗体中有若干控件,单击其中的一个按扭cmdput时,
' 执行如下的事件过程,该过程的功能是把数据输出到指定的文件中.
'请在【?】处填入正确的内容
'-------------------------------------------------------
'
'**********SPACE**********
Private Type 【?】
Number As String
Name As String
End Type
Private Sub cmdput_click()
Dim Title As String
Dim Str1 As String
Dim str2 As String
Dim stu As Student
Dim i As Integer
Open App.Path & "\student.dat" For Random As #1 Len = Len(stu)
Title = "写记录到随机文件"
Str1$ = "请输入学生号"
str2$ = "请输入学生名"
For i = 1 To 5
'**********SPACE**********
【?】.Number = InputBox(Str1$, Title$)
stu.Name = InputBox$(str2$, Title$)
Put #1, i, stu
Next i
'**********SPACE**********
Close 【?】
End Sub 展开
'-------------------------------------------------------
'【程序填空】
'-------------------------------------------------------
'题目:写出程序运行后,单击窗体,Form1上显示的内容
' sum 函数的功能为求阶乘和
' isum = 1
' isum = 3
' isum = 6
' isum = 10
' isum = 15
'请在【?】处填入正确的内容
'-------------------------------------------------------
'
Private Sub Form_Click()
Dim I As Integer, isum As Integer
'**********SPACE**********
For I = 1 To 【5】
isum = sum(I)
'**********SPACE**********
Form1.Print "isum="; 【sum(I); 】
Next I
End Sub
Private Function sum(n As Integer)
Static j As Integer
'**********SPACE**********
【?】 j + n
sum = j
End Function
第六题Option Explicit
'-------------------------------------------------------
'【程序填空】
'-------------------------------------------------------
'题目:窗体中有若干控件,单击其中的一个按扭cmdput时,
' 执行如下的事件过程,该过程的功能是把数据输出到指定的文件中.
'请在【?】处填入正确的内容
'-------------------------------------------------------
'
'**********SPACE**********
Private Type 【?】
Number As String
Name As String
End Type
Private Sub cmdput_click()
Dim Title As String
Dim Str1 As String
Dim str2 As String
Dim stu As Student
Dim i As Integer
Open App.Path & "\student.dat" For Random As #1 Len = Len(stu)
Title = "写记录到随机文件"
Str1$ = "请输入学生号"
str2$ = "请输入学生名"
For i = 1 To 5
'**********SPACE**********
【?】.Number = InputBox(Str1$, Title$)
stu.Name = InputBox$(str2$, Title$)
Put #1, i, stu
Next i
'**********SPACE**********
Close 【?】
End Sub 展开
2个回答
展开全部
窗体上添加2个文本框和1个按钮,文本框用来显示2个同学名字
Private
Sub
Command1_Click()
'交换名字
Dim
s
As
String
s
=
Text1.Text
Text1.Text
=
Text2.Text
Text2.Text
=
s
End
Sub
Private
Sub
Command1_Click()
'交换名字
Dim
s
As
String
s
=
Text1.Text
Text1.Text
=
Text2.Text
Text2.Text
=
s
End
Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
题目:窗体中有若干控件,单击其中的一个按扭cmdput时,
' 执行如下的事件过程,该过程的功能是把数据输出到指定的文件中.
'请在【?】处填入正确的内容
'-------------------------------------------------------
'
'**********SPACE**********
Private Type student
Number As String
Name As String
End Type
Private Sub cmdput_click()
Dim Title As String
Dim Str1 As String
Dim str2 As String
Dim stu As Student
Dim i As Integer
Open App.Path & "\student.dat" For Random As #1 Len = Len(stu)
Title = "写记录到随机文件"
Str1$ = "请输入学生号"
str2$ = "请输入学生名"
For i = 1 To 5
'**********SPACE**********
stu.Number = InputBox(Str1$, Title$)
stu.Name = InputBox$(str2$, Title$)
Put #1, i, stu
Next i
'**********SPACE**********
Close #1
End Sub
' 执行如下的事件过程,该过程的功能是把数据输出到指定的文件中.
'请在【?】处填入正确的内容
'-------------------------------------------------------
'
'**********SPACE**********
Private Type student
Number As String
Name As String
End Type
Private Sub cmdput_click()
Dim Title As String
Dim Str1 As String
Dim str2 As String
Dim stu As Student
Dim i As Integer
Open App.Path & "\student.dat" For Random As #1 Len = Len(stu)
Title = "写记录到随机文件"
Str1$ = "请输入学生号"
str2$ = "请输入学生名"
For i = 1 To 5
'**********SPACE**********
stu.Number = InputBox(Str1$, Title$)
stu.Name = InputBox$(str2$, Title$)
Put #1, i, stu
Next i
'**********SPACE**********
Close #1
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询