请问这个程序运行出的结果应该是什么?
textBox1.Text=IGIJM
textBox2.Text=HILFD
--------------------------------------------------------------------------
private void button1_Click(object sender, EventArgs e)
{
string ls_string = textBox1.Text.Trim() + textBox2.Text.Trim();
string ls_str = "";
string m = "";
int ls = 0;
int li_e = 3;
int li_d = 7;
int li_n = 33;
string re_str = "";
long lul_temp = 0;
long lul_x = 0;
long lul_y = 0;
int i = 0;
long lul_x0 = 0;
long lul_x1 = 0;
for (ls = 0; ls < ls_string.Length; ls++)
{
m = ls_string.Substring(ls, 1);// mid(ls_string,ls,1)
ls_str += Chr(Asc(m) - 20);
}
while (!string.IsNullOrEmpty(ls_str))
{
lul_temp = ConvertN.ToInt64(Left(ls_str, 2)); // integer(left(ls_str,2))
if (lul_temp >= li_n)
{
lul_temp = ConvertN.ToInt64(Left(ls_str, 1));
ls_str = Right(ls_str, 1);//right(ls_str,ls_str.Length - 1)
}
else
{
if (ls_str.Length >= 2)
{
ls_str = Right(ls_str, 2);
}
else
{
ls_str = "";
}
}
lul_y = 1;
for (i = 0; i < li_e; i++)
{
lul_y = lul_y * lul_temp;
}
lul_y = lul_y % 33;
re_str = re_str + lul_y.ToString();
}
textBox3.Text = re_str;
}
public string Right(string str, int len)
{
if (str.Length >= len)
{
return str.Substring(len);
}
else
{
return str;
}
}
public string Left(string str, int len)
{
if (str.Length >= len)
{
return str.Substring(0, len);
}
else
{
return str;
}
}
public int Asc(string character)
{
if (character.Length == 1)
{
System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
int intAsciiCode = (int)asciiEncoding.GetBytes(character);
return (intAsciiCode);
}
else
{
throw new Exception("Character is not valid.");
}
}
public string Chr(int asciiCode)
{
if (asciiCode >= 0 && asciiCode <= 255)
{
System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
byte[] byteArray = new byte[] { (byte)asciiCode };
string strCharacter = asciiEncoding.GetString(byteArray);
return (strCharacter);
}
else
{
throw new Exception("ASCII Code is not valid.");
}
} 说是powerbuilder程序 写个main方法测试下不就行了 三木猿 发表于 2021-12-28 11:40
写个main方法测试下不就行了
没用过PB,不会用。
页:
[1]