C# 题目: 用选择算法做出来 ----- 急 ,大家 帮忙了。。。

2025-03-22 03:29:11
推荐回答(1个)
回答1:

你看一下这个行不?
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int temp;
Console.WriteLine ("please inpnt you want 0--5 number's ASCII");
string []a=new string [5];

for (int b = 0; b < 5;b++ )
{
a[b] = Console .ReadLine ();
}
for (int i = 0; i < a.Length;i++ )
{
for (int j = 0; j {

if (a[i]>a[i + 1])
{
temp =a[i];
a[i] = a[i +1];
a[i - 1] = temp;

}

} Console.Write("{0}", Convert.ToInt32 (a[i]));

}

}
}
}