关于vb里的len函数Dim n As Integern = 156n = Str(n)n = Len(n)Print n答案是2但是Dim n As Integern = 156n = Len(Str(n))Print n答案是4为什么?
来源:学生作业帮助网 编辑:作业帮 时间:2024/12/01 17:56:02
xR]K@+ѧeU}YA(t(ՇJJF[J6i蟙;IwƤ*ds=Djzܮl%4dwqƴ-$גi~c9&dd-YFcY͂8ynOsGT-J4aL<$k@H_'Yc8A/K%+x6nF:~ଁL0\~O^\$VE
gX$T0k^[R8Ud ԙ=aPlEjLM*H. #N k=U [7ܐwnRW҄(IҨAȠ8Ba ̨;Dp6wE%:䛘Ý%Νf(>#<~ol)JʁN){={Kc[g7S5
关于vb里的len函数Dim n As Integern = 156n = Str(n)n = Len(n)Print n答案是2但是Dim n As Integern = 156n = Len(Str(n))Print n答案是4为什么?
关于vb里的len函数
Dim n As Integer
n = 156
n = Str(n)
n = Len(n)
Print n
答案是2
但是
Dim n As Integer
n = 156
n = Len(Str(n))
Print n
答案是4
为什么?
关于vb里的len函数Dim n As Integern = 156n = Str(n)n = Len(n)Print n答案是2但是Dim n As Integern = 156n = Len(Str(n))Print n答案是4为什么?
第一个答案是2,是因为n 是Integer类型,虽然用了n = Str(n),在Str(n)返回了一个字符串" 156"后,在赋值给n时又被自动类型转换为Integer型.
这时用Len()函数去求Integer型n的长度,即是求Integer类型的内存中所占的字节数.正是2.
而第二个答案是4,是因为Len()函数返回的是Str(n)的长度,而Str(n)返回的是" 156",它的长度正是4.
注意,凡是用Str()函数将数字转换成字符串的,返回的字符串都会在数字前加一个空格!
" 156"的长度就是3个数字加一个空格,所以是4.
关于vb里的len函数Dim n As Integern = 156n = Str(n)n = Len(n)Print n答案是2但是Dim n As Integern = 156n = Len(Str(n))Print n答案是4为什么?
vb题 下面程序的功能是什么?Private Sub Command1_Click() Dim s%,n% Dim a As String n = 0 a = InputBox(Please input a number:) For s = 1 To Len(a) If (func(Val(Mid(a,s,1)))) Thenn = n + 1NextPrint n End Sub Private Function func(x%) As Bool
VB的variant是什么意思比如:dim n as variant 这句什么意思,n 变成什么了
VB里面的for ...to...中的终值 步长是不会受循环中的变化而变化吗?Dim ch As String,I As Integerch = DEF For I = 1 To Len(ch) ch = Mid(ch,2 * I - 1,1) & Left(ch,Len(ch)) Print ch Next I为什么执行结果只有三行DDEFEDDEFFED
编写程序,在一个文字框中输入一个简单的英文句子,找出这个英文句子中最长的单词.用vb做关于数组的用到n=instr(s,)right left len函数redim
【VB代码】求两个并联电阻的总阻值Dim R1 As Double,R2 As Double____________________________________________________________________________________________
VB里,怎么把常数2定义成双精度?下面是我编的程序,运行了,只算n=50的时候,n=1000就不算了,究竟怎么把常数2定义成双精度呢?Dim yuanzhoulv As Double, n As Double Private Sub Command1_Click()yuanzhoulv = 2For n = 1 T
VB中 Option ExplicitPrivate Sub Form_Click()Dim 5Fg Integer (1)Dim L * og As Long (2)Dim s - ig As Single (3)Dim dob_ As Double (4)Dim _Name AS String (5)Dim bln@ Frag As Boolean (6)Dim do As Data (7)End Sub电脑上的提示
VB编程,一元二次方程a*x^2+b*x+c=0的根Dim a As Double Dim b As Double Dim c As Double Dim delta As Double Dim x1 As Double Dim x2 As Double a = Val(Text1.Text) b = Val(Text2.Text) c = Val(Text3.Text) delta = b * b -
VB:用调用函数的方法找出所有三位数的水仙花数.这是我写的代码:Private Sub Command1_Click()Dim a(101,999) As IntegerFor a = 101 To 999 Step 1If isnum = True Then Print a;NextEnd IfEnd SubPrivate Function isnum(n As Integer)
vb 一个分段函数 编程错误 我用的 vb6.0版的 编一个分段函数 如下Private Sub form_Click()Dim x As Integer,y As Integerx = Val(InputBox(请输入x值:))If x
vb,我想要问的是我要在文本框输入一串英文句子,然后按单词分解到列表框中!该怎么办?我写了一段代码:Dim midd As StringFor i = 1 To Len(Text1.Text)If mid(Text1.Text,i,1) = ThenList1.AddItem cc = Elsec = c +
vb中这句话“If e = + Or - Or × Or ÷ ”为什么是错的啊?d = Len(Text1.Text) - 1e = Mid(Text1.Text,d,1)If e = + Or - Or × Or ÷ ThenText2.Text = 1ElseText2.Text = Text2.Text & 1End Ifdim d%,dim e as string
请帮我翻译一下VB的语句吧Private Sub Command1_Click() Dim mrc As ADODB.Recordset Dim MsgText As String Dim txtSQL As String If Not Testtxt(txtClassno.Text) Then MsgBox 请输入班号!, vbOKOnly + vbExclamation,
请问以下两道VB题目怎么做1.单击分解按钮,程序提示输入一个大于2的整数,并将该数分解为因数的乘积,代码如下Private Sub Command1_Click() Dim n As Integer, Factor As Integer Dim First As Boolean Do n
vb程序设计!求1+3+5+7+…+(2n-1)的值.填空!Function func(n)Dim i As (1)For i = 1 To 2*n-1 (2)func = func + i(3)End Function
vb解二次函数代码问题!代码如下Private Sub Command1_Click()Dim a As Single,b As Single,c As SingleDim n As Single,m As Singlea = Val(Text1.Text)b = Val(Text2.Text)c = Val(Text3.Text)If b ^ 2 - 4 * a * c < 0 ThenLabel3.Caption = 无解Els
vb编程:求a=1+3+5+.+(2n-1)的值Private Sub Form_click()Dim a As IntegerDim i As IntegerDim n As Integern = InputBox(n=)For i = 1 To n a = a + 2 * n - 1Next iPrint n=; n, a=; aEnd Sub怎么不对呢?