有人可以解释每行的含义吗?

编程入门 行业动态 更新时间:2024-10-24 06:26:32
本文介绍了有人可以解释每行的含义吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

更多推荐

有人可以解释每行的含义吗?

本文发布于:2023-06-13 09:38:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/679070.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:含义

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!