728x90
SMALL

// 間違い探し

using System;

 

public class Program

{

    public static void Main()

    {

       

        SayHello();

    }

 

    public static void SayHello()

    {

        string message = "Hello";

        message += " ";

        message += "paiza";

        Console.WriteLine(message);

    }

}

//출력: paiza

/////

////

 

//

// RPGの攻ンを作ろう

using System;

 

public class Lesson06

{

    public static void Main()

    {

string[] enemies = {"スライム", "モンスタ", "ドラゴン"};

foreach(var enemy in enemies)

{

    //Console.WriteLine("勇者は" + enemy + "を攻した");

    Attack(enemy);

   

   

}

    }

 

    public static void Attack(string target)

    {

        Console.WriteLine("勇者は" + target + "を攻した");

       

    }

}

 

///

///

 

// RPGの攻ンを作ろう

using System;

 

public class Lesson06

{

    public static void Main()

    {

string[] enemies = {"スライム", "モンスタ", "ドラゴン"};

foreach(var enemy in enemies)

{

    var rand = new Random();

     var num = rand.Next(10);

    Attack(enemy,num);

   

   

}

 

    }

 

    public static void Attack(string target, int hit)

    {

        Console.WriteLine("勇者は" + target + "を攻した");

        if(hit < 5)

        {

            Console.WriteLine(target + "" + hit + "のダメジをえた");

        }

        else

        {

            Console.WriteLine("クリティカルヒット!" + target + "に100のダメジをえた");

        }

}

}

////

/////

////

///

 

728x90

설정

트랙백

댓글