.4453125void Start () {
int a = 0, b = 0, c = 0;
Swap (ref a, ref b);
print (a + " " + b);
int[] score = new int[3]{40, 30, 20} ;
if(score[1] < score[0])
ArraySwap(ref score[0], ref score[1]);
if(score[2] < score[1])
ArraySwap(ref score[1], ref score[2]);
if(score[2] < score[0])
ArraySwap(ref score[0], ref score[2]);
if(score[1] < score[0])
ArraySwap(ref score[0], ref score[1]);
for(int i = 0; i < 3; i++)
print (score[0] + " " + score[1] + " " + score[2]);
}
void Swap(ref int a, ref int b){
int temp = a;
a = b;
b = temp;
}
void ArraySwap(ref int a, ref int b){
int temp = a;
a = b;
b = temp;
}
'Computer Language > 유니티' 카테고리의 다른 글
params 매개변수 제한이 없다. (0) | 2014.04.22 |
---|---|
out 결과값을 받을때 씀 (0) | 2014.04.22 |
최대값 (0) | 2014.04.22 |
오버로딩. (0) | 2014.04.21 |
goto문 2중 for문에서 합의하에 사용가능 (0) | 2014.04.21 |