using UnityEngine;
using System.Collections;
public class ExBank2 : MonoBehaviour {
// Use this for initialization
void Start () {
int deposit = 10000;
int[]money = {2000, -1000, 3
000, -4000} ;
print (deposit);
for(int i = 0; i < money.Length; i++){
if(money[i] >=0)
deposit = AddBank(deposit, money[i]);
else
deposit = SubBank(deposit, money[i]);
print (money[i] + "=>" + deposit);
}
/*
deposit = AddBank(deposit, 2000);
print (2000 + "," + deposit);
deposit = SubBank(deposit, 1000);
print (-1000 + "," + deposit);
*/
}
int AddBank(int deposit, int money){
return deposit + money;
}
int SubBank(int deposit, int money){
deposit = deposit + money + money * 5 /100;
return deposit;
}
// Update is called once per frame
void Update () {
}
}
'Computer Language > 유니티' 카테고리의 다른 글
복리 (0) | 2014.04.08 |
---|---|
단리 (0) | 2014.04.08 |
성적 (0) | 2014.04.08 |
배열의 값을 비교(함수) 2가지 방법 (0) | 2014.04.08 |
배열의 합 (0) | 2014.04.08 |