using UnityEngine;
using System.Collections;
using System;
public class chap10_4 : MonoBehaviour {
void Print(int v){
print (string.Format("{0}", v));
}
// Use this for initialization
void Start () {
int[] scores = new int[]{80, 74, 81, 90, 34} ;
foreach(int s in scores)
print (string.Format("{0}", s));
Array.Sort(scores);
Array.ForEach<int>(scores, new Action<int>(Print));
print(string.Format("number of dimensions : {0}", scores.Rank));
print (string.Format("linear Search: 90 is at {0}", Array.IndexOf(scores, 90)));
print (string.Format("Reverse Search: 90 is at {0}", Array.LastIndexOf(scores, 90)));
}
// Update is called once per frame
void Update () {
}
}
'Computer Language > 유니티' 카테고리의 다른 글
find 함수 (0) | 2014.05.16 |
---|---|
c# array2 (0) | 2014.05.16 |
int[] a -> System.Array (0) | 2014.05.16 |
using 사용법 (0) | 2014.05.16 |
배열 선언 (0) | 2014.05.16 |