1 2 3 5 7 8 |
前田稔(Maeda Minoru)の超初心者のプログラム入門
![]()
![]()
/**********************************************/
/*★ C# Sort Function Program 前田 稔 ★*/
/**********************************************/
using System;
class Prog
{
public static void Main()
{
int[] tbl = new int[4]{5,1,7,3};
sort(tbl,4);
Console.WriteLine("{0} {1} {2} {3}", tbl[0], tbl[1], tbl[2], tbl[3]);
Console.ReadLine();
}
static void sort(int[] t, int n)
{
int i,j,wk;
for(i=0; i<n-1; i++)
for(j=i+1; j<n; j++)
{
if (t[i] > t[j])
{ wk=t[i]; t[i]=t[j]; t[j]=wk; }
}
}
}
|
![]()
| int[] tbl = {5,1,7,3,8,2}; |
| tbl.GetLength(0) |
| static void sort(int[] tbl) |
| for(int i=0; i<tbl.GetLength(0); i++) |
![]()