帮帮忙,看下这几道VB题 5
'-------------------------------------------------------'【程序填空】'---------------------...
'-------------------------------------------------------
'【程序填空】
'-------------------------------------------------------
'题目: 用户单击命令按钮后,程序将文本框Text1中的文本反转显示,
' 同时在文本框Text2中显示文本框Text1框中字符串的个数?
' 设在一个窗体中已经设置了二个文本框Text1和Text2,
' 以及一个命令按钮,且设计有下列程序,请指出程序的功能。
'请在_____处填入正确的内容
'-------------------------------------------------------
'
Private Sub Command1_Click()
If Text1.Text = "" Then
Exit Sub
Text2.Text = 0
Else
'**********FILL**********
Text1.Text = MyFun_____
End If
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = 0
End Sub
Private Function MyFun(s1 As String) As String
Dim Pos As Integer
Dim Str1 As String
Dim intC As Integer
Const Sp As String = ""
'**********FILL**********
Pos = Len(_____)
For intC = Pos To 1 Step -1
Str1 = Str1 & Mid(s1, intC, 1)
Next intC
'**********FILL**********
MyFun = _____
Text2.Text = Pos
End Function
【程序填空】
'-------------------------------------------------------
'题目:编程序求表达式s=x/2!+x^3/4!+...+x^(2n-1)/(2n)!的值,'并在窗体上输出。
'(1)变量x与n的值在窗体单击事件中用InputBox()函数输入,通过调用函数过程s实现题目要求。
'(2).求表达式的值用函数过程Function s(n%,x!) As Single完成。
''请去掉_____,并填入正确的内容。
Private Sub Form_Click()
Dim x As Single
Dim n As Integer
Dim sum As Single
x = Val(InputBox("Please input x Value:"))
n = Val(InputBox("Please input a integer:"))
'**********FILL**********
sum = _____
Print "s="; sum
End Sub
Function s(n As Integer, x As Single) As Single
Dim i As Single, t As Long
s = 0
For i = 1 To n
t = 1
For j = 1 To 2 * i
'**********FILL**********
_____
Next j
'**********FILL**********
s = s + x ^ (_____) / t
Next i
End Function
'要求在Text1中输入一段字符,选中“大写转为小写小写转为大写”,
'单击转换按钮后,Text2显示大小写相反的字符串;选中“全部小写”,
'单击转换按钮后,Text2显示全部小写的字符串;
'选中“全部大写”,单击转换按钮后,Text2显示全部大写的字符串。
'-------------------------------------------------------
Private Sub Command1_Click()
Dim n As Integer, k As Integer, ch As String, a As String
'**********FILL**********
n = Len(_____)
ch = ""
For k = 1 To n
'**********FILL**********
a = Mid(Text1.Text, _____,1)
If Option1.Value = True Then
If a >= "a" And a <= "z" Then
ch = ch + UCase(a)
ElseIf a >= "A" And a <= "Z" Then
ch = ch + LCase(a)
Else
ch = ch + a
End If
End If
If Option2.Value = True Then
ch = UCase(Text1)
End If
If Option3.Value = True Then
ch = LCase(Text1)
End If
Text2 = ch
'**********FILL**********
_____
End Sub 展开
'【程序填空】
'-------------------------------------------------------
'题目: 用户单击命令按钮后,程序将文本框Text1中的文本反转显示,
' 同时在文本框Text2中显示文本框Text1框中字符串的个数?
' 设在一个窗体中已经设置了二个文本框Text1和Text2,
' 以及一个命令按钮,且设计有下列程序,请指出程序的功能。
'请在_____处填入正确的内容
'-------------------------------------------------------
'
Private Sub Command1_Click()
If Text1.Text = "" Then
Exit Sub
Text2.Text = 0
Else
'**********FILL**********
Text1.Text = MyFun_____
End If
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = 0
End Sub
Private Function MyFun(s1 As String) As String
Dim Pos As Integer
Dim Str1 As String
Dim intC As Integer
Const Sp As String = ""
'**********FILL**********
Pos = Len(_____)
For intC = Pos To 1 Step -1
Str1 = Str1 & Mid(s1, intC, 1)
Next intC
'**********FILL**********
MyFun = _____
Text2.Text = Pos
End Function
【程序填空】
'-------------------------------------------------------
'题目:编程序求表达式s=x/2!+x^3/4!+...+x^(2n-1)/(2n)!的值,'并在窗体上输出。
'(1)变量x与n的值在窗体单击事件中用InputBox()函数输入,通过调用函数过程s实现题目要求。
'(2).求表达式的值用函数过程Function s(n%,x!) As Single完成。
''请去掉_____,并填入正确的内容。
Private Sub Form_Click()
Dim x As Single
Dim n As Integer
Dim sum As Single
x = Val(InputBox("Please input x Value:"))
n = Val(InputBox("Please input a integer:"))
'**********FILL**********
sum = _____
Print "s="; sum
End Sub
Function s(n As Integer, x As Single) As Single
Dim i As Single, t As Long
s = 0
For i = 1 To n
t = 1
For j = 1 To 2 * i
'**********FILL**********
_____
Next j
'**********FILL**********
s = s + x ^ (_____) / t
Next i
End Function
'要求在Text1中输入一段字符,选中“大写转为小写小写转为大写”,
'单击转换按钮后,Text2显示大小写相反的字符串;选中“全部小写”,
'单击转换按钮后,Text2显示全部小写的字符串;
'选中“全部大写”,单击转换按钮后,Text2显示全部大写的字符串。
'-------------------------------------------------------
Private Sub Command1_Click()
Dim n As Integer, k As Integer, ch As String, a As String
'**********FILL**********
n = Len(_____)
ch = ""
For k = 1 To n
'**********FILL**********
a = Mid(Text1.Text, _____,1)
If Option1.Value = True Then
If a >= "a" And a <= "z" Then
ch = ch + UCase(a)
ElseIf a >= "A" And a <= "Z" Then
ch = ch + LCase(a)
Else
ch = ch + a
End If
End If
If Option2.Value = True Then
ch = UCase(Text1)
End If
If Option3.Value = True Then
ch = LCase(Text1)
End If
Text2 = ch
'**********FILL**********
_____
End Sub 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询