A. 為一個冒泡排序程序設計測試用例。並測試之(C語言編程)
static void Main(string[] args)
{
int [] arrarys={12,78,89,45,56,263,15,05,26,35};
for (int i = 0; i < arrarys.Length; i++)
{
for (int j = 0; j < i; j++)
{
if(arrarys[i]>arrarys[j])
{
int emp = 0;
emp = arrarys[i];
arrarys[i] = arrarys[j];
arrarys[j] = emp;
}
}
}
foreach (int arr in arrarys)
{
Console.Write(arr);
Console.WriteLine();
}
Console.ReadKey();
}