커뮤니티

EA SPORTS FC ONLINE에 대해 이야기 나누세요.
Hjrank091 맨시티는레전드11.17(월)조회 654비추천 0
nternal class Program
{
    static int[] DrawDice()
    {
        Random rnd = new Random();
        int[] diceAry = new int[3];

        for (int i = 0; i < diceAry.Length; i++)
            diceAry[i] = rnd.Next(1, 6);

        return diceAry;

        int[] ary;
        ary = DrawDice();

    }
    static void Main(string[] args)
    {
        int[] ary;
        int count = 0;
        while (true)
        {
            count++;
            ary = DrawDice();
            Console.Write("{0}회 던졌음 ==> ", count);
            for (int i = 0; i < ary.Length; i++)
            {
                Console.Write(ary[i] + " ");
            }
            Console.WriteLine();

            Console.Write("계속 진행하시려면 엔터키를 입력하세요.");
            Console.ReadLine();
            if (ary[0] == ary[1] && ary[1] == ary[2])
            {
                Console.WriteLine("3개의 숫자가 맞았습니다.종료합니다.");
                    break; 
            }
            
        }
        }
          
    }
0 0
댓글 0
0/200