using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 第N天
{
internal class Program
{
public Program()
{
Console.WriteLine("请输入十个数字并用逗号分隔");
String shu = Convert.ToString (Console.ReadLine());
string[] ss = shu.Split(' ');
for (int i = 0; i < shu.Length-1; i++)
{
int shu1 = i;
for (int j = i + 1; j < shu.Length-1-i ; j ++)
{
if (shu[i ] > shu[j-1])
{
shu1 = shu[j];
}
}
}
for (int i = 0; i < shu.Length; i++)
{
Console.Write("{0}", shu[i]);
}
}
static void Main(string[] args)
{
Program pro = new Program();
Console.ReadKey();
}
}
}
你这代码写的奇奇怪怪的
shu1 你赋予了最大值,但是你没有把他保存回去啊
18 行处 应为 交换shu[i ] shu[j-1] 的代码