当前位置:编程学习 > VB >>

vb编程求答,括号内填什么,急用啊

1、下列程序在文本框text1中输入任意字符串,并按相反的顺序显示在文本框text2中

Private Sub Form_Click()
Dim n As String, c As String, d As String
n = text1.Text
m = text1.Text
For i = m To 1 Step -1
c = Mid(n, i, 1)
d=( )
Next i
( )

End Sub

 

 

2、下面是一段计算数学表达式的1-2/2!+3/3!-4/4!+……+(-1)^(n+1)*n/n!程序请问括号中要填什么。急用,谢谢。

Private Sub Form_Click()
Dim n As Integer, p As Integer, s As Single, q As Integer, p As Integer
n = InputBox("请输入N的值:")
s = 0: p = -1: q = 1
For i = 1 To n
p=-p:q=( )
s=( )
( )
Print s
End Sub

 

 

答案:
Private Sub Form_Click()
Dim n As String, c As String, d As String
n = Text1.Text
m = Len(n)
For i = m To 1 Step -1
  c = Mid(n, i, 1)
  d = d + c
Next i
Text2.Text = d
End Sub
第一题的。你那个m哪儿有问题;

Private Sub Form_Click()
Dim n As Integer, p As Integer, s As Single, q As Integer
n = InputBox("请输入N的值:")
s = 0: p = -1: q = 1
For i = 1 To n
p = -p: q = q * i
s = s + p * i / q
Next i
Print s
End Sub
第二题的。

上一个:vb编程一直出现错误,这个错误怎么解决?
下一个:求VB 编程语法使用方面的资料。谢谢。。

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,