有人可以解释每行的含义吗? [英] Can someone explain what each line means?

查看:87
本文介绍了有人可以解释每行的含义吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Dim s,temp As String

Dim a,b,c As Long



a = CLng(Val(TxtBoxInput.Text) )

s = TxtBoxInput.Text

TxtBoxInput.Clear()

for i = 1 to Len(s)Step 1

b = CLng(Mid(s,i,1))

c = Len(s) - i

b = CLng(Val(b)*(2 ^ c ))

temp = CStr(Val(temp)+ b)

Next i



MessageBox.Show (temp)

Dim s, temp As String
Dim a, b, c As Long

a = CLng(Val(TxtBoxInput.Text))
s = TxtBoxInput.Text
TxtBoxInput.Clear()
For i = 1 To Len(s) Step 1
b = CLng(Mid(s, i, 1))
c = Len(s) - i
b = CLng(Val(b) * (2 ^ c))
temp = CStr(Val(temp) + b)
Next i

MessageBox.Show(temp)

推荐答案

设置一些变量

make a = a number =在文本框中输入的内容

make s =文本框中的文字

清除文本框

文本框中的每个字符

set b =那个角色

设置c =原始字符串的长度减去字符串中我们正在寻找的位置

计算b = b ^ c(即b到c)的力量

将b连接到临时结束



因此需要一个数字,并且r每个数字从数字右侧计算其位置功率的值,并将其作为新数字计算出来



例如



输入123



输出......

1 ^ 3 + 2 ^ 2 + 3 ^ 1



= 1 + 4 + 3

= 8
Set up some variables
make a = a number = whatever was typed into the text box
make s = the text from the text box
clear the text box
for each character in the text box
set b = that character
set c = the length of the original string less the position within the string that we''re looking
calculate b = b ^ c (i.e. b to the power of c)
concatenate b to the end of temp

So it takes a number, and for each digit calculates its value to the power of its position from teh right of the number, and wriutes that out as a new number

e.g

input 123

output ...
1 ^ 3 + 2 ^ 2 + 3 ^ 1

= 1 + 4 + 3
= 8


这篇关于有人可以解释每行的含义吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆