728x90
SMALL

// 2次元配列の要素を更新する

using System;

 

public class Lesson05

{

    public static void Main()

    {

        string[][] basket = {

            new string[] {"木の棒", "石斧"},

            new string[] {"おにぎり", "おにぎり"},

            new string[] {"毒消し", ""}

        };

 

        // ここに、要素を更新するコドを記述する

 

 

        Console.WriteLine(basket[0][0]);

        Console.WriteLine(basket[0][1]);

        Console.WriteLine(basket[1][0]);

        Console.WriteLine(basket[1][1]);

        Console.WriteLine(basket[2][0]);

        Console.WriteLine(basket[2][1]);

    }

}

 

////

//

// 2次元配列の要素の個を出力する

using System;

 

public class Lesson05

{

    public static void Main()

    {

        string[][] basket = {

            new string[] {"木の棒", "こん棒"},

            new string[] {"おにぎり", "おにぎり"},

            new string[] {"毒消し", ""}

        };

 

        // ここに、個を出力するコドを記述する

Console.WriteLine(basket[0].Length);

    }

}

//

//

// 2次元配列をルプで理する

using System;

 

public class Lesson05

{

    public static void Main()

    {

        string[][] teams = {

    new string[] {"勇者", "", "魔法使い"},

    new string[] {"", "忍者", "商人"},

    new string[] {"スライム", "ドラゴン", "魔王"},

    new string[] {"踊り子", "molar", "チャ"}

    };

   

   for(int i=0; i<teams.Length; i++)

    {

        for (int j=0; j<teams[i].Length;j++)

        {

            Console.Write(i);

            Console.Write(j);

            Console.Write(" ");

           // Console.Write(teams[i][j] + " ");

           

        }

        Console.WriteLine();

       

    }

   

   

}

}

// 출력 결과

00 01 02

10 11 12

20 21 22

30 31 32

//

//

// 2次元配列をルプで理する

using System;

 

public class Lesson05

{

    public static void Main()

    {

        string[][] teams = {

    new string[] {"勇者", "", "魔法使い"},

    new string[] {"", "忍者", "商人"},

    new string[] {"スライム", "ドラゴン", "魔王"},

    new string[] {"踊り子", "molar", "チャ"}

    };

   

   for(int i=0; i<teams.Length; i++)

    {

        for (int j=0; j<teams[i].Length;j++)

        {

            //Console.Write(i);

            //Console.Write(j);

            //Console.Write(" ");

           Console.Write(teams[i][j] + " ");

           

        }

        Console.WriteLine();

        

    }

   

   

}

}

//

//출력내용

//

勇者 魔法使い

忍者 商人

スライム ドラゴン 魔王

踊り子 molar チャ

//

 

728x90

설정

트랙백

댓글