コード例 #1
0
        public void TakeMoney(BatchCoins coinBatch)
        {
            bool check = false;

            foreach (Coins coin in coinBatch)
            {
                if (CheckCoins(coin))
                {
                    check = true;
                }
                else
                {
                    check = false;
                    break;
                }
            }
            foreach (Coins coin in coinBatch)
            {
                if (check == true)
                {
                    if (coinDesk.ContainsKey(coin.CoinAmmount))
                    {
                        coinDesk[coin.CoinAmmount] += 1;
                    }
                    else
                    {
                        coinDesk.Add(coin.CoinAmmount, 1);
                    }
                }
            }
        }
コード例 #2
0
 public void TakeMoney(BatchCoins coinBatch)
 {
     bool check = false;
     foreach (Coins coin in coinBatch)
     {
         if (CheckCoins(coin))
         {
             check = true;
         }
         else
         {
             check = false;
             break;
         }
     }
     foreach (Coins coin in coinBatch)
     {
         if (check == true)
         {
             if (coinDesk.ContainsKey(coin.CoinAmmount))
             {
                 coinDesk[coin.CoinAmmount] += 1;
             }
             else
             {
                 coinDesk.Add(coin.CoinAmmount, 1);
             }
         }
     }
 }