标题:怎样用if语句写这个程序?
只看楼主
daone
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2006-5-11
得分:0 

C#
public void ss()
{
Encoding ascii = Encoding.ASCII;

string[] str ={ "r", "e", "z" };
string t= "";
for (int i = 1; i <3; i++)
{
for (int j = 2; j >=i; j--)
{
Byte[] aa = ascii.GetBytes(str[j - 1]);
int s1 = (int)aa[0];
Byte[] bb = ascii.GetBytes(str[j]);
int s2 = (int)bb[0];
if (s1 < s2)
{
t = str[j-1];
str[j-1] = str[j];
str[j] = t;
}
}
}
this.textBox1.Text = str[0]+str[1]+str[2];
}

2007-10-10 13:38
woshizcl
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2007-6-2
得分:0 

为什么非要来新人区回帖10篇啊


2007-10-10 13:46



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-175417-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.658455 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved